From: Sebastien Dugue <sebastien.dugue@bull.net>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
Tim Chavez <tinytim@us.ibm.com>,
Linux-rt <linux-rt-users@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Jean Pierre Dion <jean-pierre.dion@bull.net>,
linux-ppc <linuxppc-dev@ozlabs.org>,
Paul Mackerras <paulus@samba.org>,
Gilles Carry <Gilles.Carry@ext.bull.net>
Subject: Re: [PATCH 2/2][RT] powerpc - Make the irq reverse mapping radix tree lockless
Date: Fri, 25 Jul 2008 10:34:18 +0200 [thread overview]
Message-ID: <20080725103418.2ae898f5@bull.net> (raw)
In-Reply-To: <1216972177.7257.351.camel@twins>
Hi Peter,
On Fri, 25 Jul 2008 09:49:37 +0200 Peter Zijlstra <peterz@infradead.org> wr=
ote:
> On Thu, 2008-07-24 at 14:18 +0200, Sebastien Dugue wrote:
> > On Thu, 24 Jul 2008 21:11:34 +1000 Nick Piggin <nickpiggin@yahoo.com.au=
> wrote:
> >=20
> > > On Thursday 24 July 2008 20:50, Sebastien Dugue wrote:
> > > > From: Sebastien Dugue <sebastien.dugue@bull.net>
> > > > Date: Tue, 22 Jul 2008 11:56:41 +0200
> > > > Subject: [PATCH][RT] powerpc - Make the irq reverse mapping radix t=
ree
> > > > lockless
> > > >
> > > > The radix tree used by interrupt controllers for their irq reverse
> > > > mapping (currently only the XICS found on pSeries) have a complex l=
ocking
> > > > scheme dating back to before the advent of the concurrent radix tre=
e 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 un=
der us
> > > > to simplify the locking.
> > > >
> > > > Concurrency between readers and writers are handled by the intrin=
sic
> > > > properties of the concurrent radix tree. Concurrency between the tr=
ee
> > > > initialization which is done asynchronously with readers and writer=
s access
> > > > is handled via an atomic variable (revmap_trees_allocated) set when=
the
> > > > tree has been initialized and checked before any reader or writer a=
ccess
> > > > just like we used to check for tree.gfp_mask !=3D 0 before.
> > >=20
> > > Hmm, RCU radix tree is in mainline too for quite a while. I thought
> > > Ben had already converted this code over ages ago...
> >=20
> > 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.
>=20
> Should be. The model of the concurrent radix tree can be mapped to
> spinlock + rcu radix tree.
>=20
> So instead of:
>=20
> > =EF=BB=BF+ DEFINE_RADIX_TREE_CONTEXT(ctx, tree);
> > + radix_tree_lock(&ctx);
> > + radix_tree_insert(ctx.tree, hwirq, &irq_map[virq]);
> > + radix_tree_unlock(&ctx);
>=20
>=20
> you then write:
>=20
> 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);
>=20
Cool, that will indeed makes it much easier to have something applicable
to mainline which works with preempt-rt.
>=20
> 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 mapp=
ing
while another one is unloaded at the same time. The time window is pretty n=
arrow,
but still present nonetheless. That's why I chose to use the concurrent ver=
sion.
>=20
> 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.
next prev parent reply other threads:[~2008-07-25 8:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-24 10:23 [PATCH 0/2][RT] powerpc - fix bug in irq reverse mapping radix tree (Resend) Sebastien Dugue
2008-07-24 10:48 ` [PATCH 1/2][RT] powerpc - XICS: move the call to irq_radix_revmap from xics_startup to xics_host_map Sebastien Dugue
2008-07-24 10:50 ` [PATCH 2/2][RT] powerpc - Make the irq reverse mapping radix tree lockless Sebastien Dugue
2008-07-24 11:11 ` Nick Piggin
2008-07-24 12:18 ` Sebastien Dugue
2008-07-25 7:49 ` Peter Zijlstra
2008-07-25 8:27 ` Benjamin Herrenschmidt
2008-07-25 8:36 ` Sebastien Dugue
2008-07-25 8:40 ` Benjamin Herrenschmidt
2008-07-25 8:47 ` Sebastien Dugue
2008-07-25 8:34 ` Sebastien Dugue [this message]
2008-07-25 5:13 ` Benjamin Herrenschmidt
-- strict thread matches above, loose matches on Subject: below --
2008-07-23 14:59 [PATCH 0/2][RT] powerpc - fix bug in irq reverse mapping radix tree Sebastien Dugue
2008-07-23 15:01 ` [PATCH 2/2][RT] powerpc - Make the irq reverse mapping radix tree lockless Sebastien Dugue
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080725103418.2ae898f5@bull.net \
--to=sebastien.dugue@bull.net \
--cc=Gilles.Carry@ext.bull.net \
--cc=jean-pierre.dion@bull.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=nickpiggin@yahoo.com.au \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=tinytim@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).