From: Keir Fraser <keir.xen@gmail.com>
To: Jan Beulich <JBeulich@novell.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: [xen-unstable test] 6947: regressions - trouble: broken/fail/pass
Date: Mon, 02 May 2011 16:45:02 +0100 [thread overview]
Message-ID: <C9E4900E.17180%keir.xen@gmail.com> (raw)
In-Reply-To: <4DBED61F020000780003F2D3@vpn.id2.novell.com>
On 02/05/2011 15:04, "Jan Beulich" <JBeulich@novell.com> wrote:
>> The most straightforward way to convert to RCU with the most similar
>> synchronising semantics would be to add a 'live' boolean flag to each
>> pirq-related struct that is stored in a radix tree. Then:
>> * insertions into radix tree would be moved before acquisition of the
>> irq_desc lock, then set 'live' under the lock
>> * deletions would clear 'live' under the lock, then do the actual radix
>> deletion would happen after irq_desc lock release;
>> * lookups would happen as usual under the irq_desc lock, but with an extra
>> test of the 'live' flag.
>
> This still leaves unclear to me how an insert hitting a not-yet-deleted
> (but no longer live) entry should behave. Simply setting 'live' again
> won't help, as that wouldn't cover a delete->insert->delete all
> happening before the first delete's grace period expires. Nor would
> this work with populating the new data (prior to setting live) when
> the old data might sill be used.
Yes, this is why in my follow-up email I explained that a secondary lock is
needed that covers both logical and physical insertion/deletion. Then the
case you describe above cannot happen. As you say, event_lock covers us.
> But wait - what you describe doesn't need RCU anymore, at least
> as long as the code paths from radix tree insert to setting 'live'
> (and similarly from clearing 'live' to doing the radix tree delete) are
> fully covered by some other lock (d->event_lock, see below). Am
> I overlooking something?
No, I think you just misunderstand RCU. What I (and now also you, a bit
independently ;-) have described is how to synchronise writers against other
writers -- e.g., someone inserting concurrently with deleting, as you
describe above. What RCU is all about is synchronising *readers* against
writers, without needing a lock. And we still need it because the radix-tree
updates will happen under d->event_lock, which the readers in IRQ context
will not be holding. The main thing that RCU generally needs is that, when a
node is deleted from a structure (radix-tree in this case) it cannot be
freed until an RCU grace period because concurrent lock-free readers may
still hold a pointer to it. There are also other details to consider but
actually the whole RCU issue appears to be handled by Linux's radix-tree
implementation -- we just need to pull an up-to-date version across into
Xen.
-- Keir
next prev parent reply other threads:[~2011-05-02 15:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-01 19:56 [xen-unstable test] 6947: regressions - trouble: broken/fail/pass xen.org
2011-05-01 20:48 ` Keir Fraser
2011-05-02 9:01 ` Jan Beulich
2011-05-02 11:22 ` Keir Fraser
2011-05-02 12:00 ` Jan Beulich
2011-05-02 12:13 ` Keir Fraser
2011-05-02 12:24 ` Jan Beulich
2011-05-02 12:19 ` Keir Fraser
2011-05-02 12:29 ` Jan Beulich
2011-05-02 13:14 ` Keir Fraser
2011-05-02 13:39 ` Keir Fraser
2011-05-02 14:04 ` Jan Beulich
2011-05-02 15:45 ` Keir Fraser [this message]
2011-05-02 16:36 ` Dan Magenheimer
2011-05-02 17:07 ` Keir Fraser
2011-05-03 9:35 ` Jan Beulich
2011-05-03 10:09 ` Keir Fraser
2011-05-03 13:36 ` Jan Beulich
2011-05-03 14:09 ` Keir Fraser
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=C9E4900E.17180%keir.xen@gmail.com \
--to=keir.xen@gmail.com \
--cc=JBeulich@novell.com \
--cc=xen-devel@lists.xensource.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).