From: Keir Fraser <keir.xen@gmail.com>
To: Jan Beulich <JBeulich@novell.com>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH] switch rangeset's lock to rwlock
Date: Mon, 28 Mar 2011 09:54:19 +0100 [thread overview]
Message-ID: <C9B60B4B.15779%keir.xen@gmail.com> (raw)
In-Reply-To: <4D90618602000078000389AE@vpn.id2.novell.com>
On 28/03/2011 09:23, "Jan Beulich" <JBeulich@novell.com> wrote:
> As I said in the description, the rangeset code is of general library
> kind, and hence shouldn't make assumptions on the sort of data
> stored in rangesets. While I agree that in many cases the read
> side critical section would be small, there can be exceptions.
Because of rangeset_report_ranges()? Well, we could equally say that it is
not nice to be executing a callback in a spinlock critical section. For
example, the __copy_to_guest_offset() in the current sole callback handler
will be invalid for any guest using xenpaging (when that works properly)
since paging work could be done in there. Not a problem right now of course,
not least because the callback is executed only for dom0.
For that one iterator function I'm sure we could devise a method for
executing callbacks with no lock held, without resorting to RCU. Again, this
would be preferable to using rwlocks.
> Using RCU in this kind of a leaf, independent of almost anything
> else library routine would seem odd.
Callers wouldn't see the RCU-ness.
Not that I'm arguing to make rangesets use RCU, or avoid holding a lock
during report_ranges callbacks. I think concurrency bottlenecks in that code
are a non-issue.
> The only reason to stay with spinlocks was imo if you indeed
> wanted to knock off rwlocks altogether, which would new seem
> contrary to your c/s 23099:612171ff82ea.
Well they're only used now in code that is outside my personal areas of
interest. I'd prefer more sensible locking strategies to be used, but I'm
not going to remove code from Xen as an alternative, nor am I going to do
the work myself. So rwlocks remain in their current limited uses.
>> I need to double check, but I believe we have only a couple of rwlock users
>> now, and none of the read-side critical sections are large, so in that case
>> I suggest we switch them to use spinlocks and kill our rwlock
>> implementation.
>
> Indeed, there's only tmem without the two patches I had sent. One
> of the reasons for putting them together was to actually have some
> *active* users of rwlocks again, so the code wouldn't have too good
> chances to bit-rot.
>
> Further, I've taken note of a few other locks that may be
> candidates for conversion to rwlocks (pcidevs_lock being the
> most prominent example), requiring closer inspection and possibly
> code adjustments other than the mere lock kind conversion.
There'd be a bigger win in fragmenting pcidevs_lock, I'm sure. It looks like
it would be easy to do, it covers all sorts of stuff at the moment.
-- Keir
> Jan
>
next prev parent reply other threads:[~2011-03-28 8:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-25 16:49 [PATCH] switch rangeset's lock to rwlock Jan Beulich
2011-03-25 17:08 ` Keir Fraser
2011-03-25 17:52 ` Dan Magenheimer
2011-03-25 20:52 ` Keir Fraser
2011-03-30 22:44 ` Jeremy Fitzhardinge
2011-03-28 8:23 ` Jan Beulich
2011-03-28 8:54 ` Keir Fraser [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-09-12 12:55 Jan Beulich
2014-09-18 10:43 ` Tim Deegan
2014-09-18 12:15 ` Jan Beulich
2014-09-18 13:02 ` Tim Deegan
2014-09-18 13:32 ` Jan Beulich
2014-09-18 14:52 ` Paul Durrant
2014-09-19 16:33 ` Konrad Rzeszutek Wilk
2014-09-22 9:42 ` Ian Campbell
2014-09-22 10:34 ` Jan Beulich
2014-09-19 16:32 ` Konrad Rzeszutek Wilk
2014-09-30 8:50 ` Jan Beulich
2014-09-30 12:01 ` Tim Deegan
2014-09-30 20:53 ` Keir Fraser
2014-10-01 8:57 ` Jan Beulich
2014-10-01 9:31 ` 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=C9B60B4B.15779%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).