[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080725103418.2ae898f5@bull.net>
Date: Fri, 25 Jul 2008 10:34:18 +0200
From: Sebastien Dugue <sebastien.dugue@...l.net>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Nick Piggin <nickpiggin@...oo.com.au>,
Linux-rt <linux-rt-users@...r.kernel.org>,
linux-ppc <linuxppc-dev@...abs.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <michael@...erman.id.au>,
Tim Chavez <tinytim@...ibm.com>,
Jean Pierre Dion <jean-pierre.dion@...l.net>,
Gilles Carry <Gilles.Carry@....bull.net>
Subject: Re: [PATCH 2/2][RT] powerpc - Make the irq reverse mapping radix
tree lockless
Hi Peter,
On Fri, 25 Jul 2008 09:49:37 +0200 Peter Zijlstra <peterz@...radead.org> wrote:
> On Thu, 2008-07-24 at 14:18 +0200, Sebastien Dugue wrote:
> > On Thu, 24 Jul 2008 21:11:34 +1000 Nick Piggin <nickpiggin@...oo.com.au> wrote:
> >
> > > On Thursday 24 July 2008 20:50, Sebastien Dugue wrote:
> > > > From: Sebastien Dugue <sebastien.dugue@...l.net>
> > > > Date: Tue, 22 Jul 2008 11:56:41 +0200
> > > > Subject: [PATCH][RT] powerpc - Make the irq reverse mapping radix tree
> > > > lockless
> > > >
> > > > The radix tree used by interrupt controllers for their irq reverse
> > > > mapping (currently only the XICS found on pSeries) have a complex locking
> > > > scheme dating back to before the advent of the concurrent radix tree on
> > > > preempt-rt.
> > > >
> > > > Take advantage of this and of the fact that the items of the tree are
> > > > pointers to a static array (irq_map) elements which can never go under us
> > > > to simplify the locking.
> > > >
> > > > Concurrency between readers and writers are handled by the intrinsic
> > > > properties of the concurrent radix tree. Concurrency between the tree
> > > > initialization which is done asynchronously with readers and writers access
> > > > is handled via an atomic variable (revmap_trees_allocated) set when the
> > > > tree has been initialized and checked before any reader or writer access
> > > > just like we used to check for tree.gfp_mask != 0 before.
> > >
> > > Hmm, RCU radix tree is in mainline too for quite a while. I thought
> > > Ben had already converted this code over ages ago...
> >
> > Mainline does not have the concurrent radix tree which this patch
> > is based on, but maybe it's overkill and the RCU radix tree is enough.
> > Not sure, will have to think about it a bit more.
>
> Should be. The model of the concurrent radix tree can be mapped to
> spinlock + rcu radix tree.
>
> So instead of:
>
> > + DEFINE_RADIX_TREE_CONTEXT(ctx, tree);
> > + radix_tree_lock(&ctx);
> > + radix_tree_insert(ctx.tree, hwirq, &irq_map[virq]);
> > + radix_tree_unlock(&ctx);
>
>
> you then write:
>
> spin_lock(&host->revmap_data.tree_lock);
> radix_tree_insert(&host->revmap_data.tree, hwirq, &irq_map[virq]);
> spin_unlock(&host->revmap_data.tree_lock);
>
Cool, that will indeed makes it much easier to have something applicable
to mainline which works with preempt-rt.
>
> The only advantage of the concurrent radix tree over this model is that
> it can potentially do multiple modification operations at the same time.
Well in theory that can happen if a module is loaded which creates a mapping
while another one is unloaded at the same time. The time window is pretty narrow,
but still present nonetheless. That's why I chose to use the concurrent version.
>
> Still, cool that you used it ;-)
Yep, looked like what was needed until I realized it was not available in
mainline. Nice work though and good paper for explaining it all.
Sebastien.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists