From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Jan Beulich <jbeulich@novell.com>
Cc: xen-devel@lists.xensource.com, Keir Fraser <keir.fraser@eu.citrix.com>
Subject: Re: Xen spinlock questions
Date: Tue, 05 Aug 2008 11:09:46 -0700 [thread overview]
Message-ID: <4898976A.3080406@goop.org> (raw)
In-Reply-To: <48981005.76E4.0078.0@novell.com>
Jan Beulich wrote:
>>> 2) While on native not re-enabling interrupts in __raw_spin_lock_flags()
>>> may be tolerable (but perhaps questionable), not doing so at least on
>>> the slow path here seems suspicious.
>>>
>>>
>> I wasn't sure about that. Is it OK to enable interrupts in the middle
>> of a spinlock? Can it be done unconditionally?
>>
>
> That used to be done in the pre-ticket lock implementation, but of course
> conditional upon the original interrupt flag.
>
Right, I see. The spin_lock_flags stuff which the current lock
implementation just ignores. I'll add a new lock op for it.
> Later yesterday I noticed another issue: The code setting lock_spinners
> isn't interruption safe - you'll need to return the old value from
> spinning_lock() and restore it in unspinning_lock().
>
Good catch.
> Also I'm considering doing it ticket-based nevertheless, as "mix(ing) up
> next cpu selection" won't really help fairness in xen_spin_unlock_slow().
>
Why's that? An alternative might be to just wake all cpus waiting for
the lock up, and then let them fight it out. It should be unusual that
there's a significant number of waiters anyway, since contention is
(should be) rare.
The main reason for ticket locks is to break the egregious unfairness
that (some) bus protocols implement. That level of fairness shouldn't
be necessary here because once the cpus fall to blocking in the
hypervisor, it's up to Xen to tie-break.
> Apart from definitely needing the wakeup to happen for just the target
> CPU (Keir, I'd want the necessary support in Xen done for that to work
> regardless of performance measurements with the traditional locking,
> as it's known that with ticket locks performance suffers from wrong-
> order CPU kicking), one thing we'd be in even more need for here than
> old-style spin locks had been would be a directed yield (sub-)hypercall.
> Has that ever been considered to become a schedop?
>
Considered. But the point of this exercise was to come up with
something that would work with an unmodified hypervisor.
J
next prev parent reply other threads:[~2008-08-05 18:09 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-04 10:18 Xen spinlock questions Jan Beulich
2008-08-04 10:24 ` Keir Fraser
2008-08-11 12:22 ` Jan Beulich
2008-08-11 12:25 ` Keir Fraser
2008-08-11 14:41 ` Keir Fraser
2008-08-11 18:11 ` Jeremy Fitzhardinge
2008-08-11 18:31 ` Keir Fraser
2008-08-11 18:49 ` Jeremy Fitzhardinge
2008-08-12 9:00 ` Keir Fraser
2008-08-12 16:33 ` Jeremy Fitzhardinge
2008-08-12 17:00 ` Keir Fraser
2008-08-15 12:15 ` Jan Beulich
2008-08-15 13:01 ` Keir Fraser
2008-08-15 14:06 ` Jan Beulich
2008-08-18 10:01 ` Keir Fraser
2008-08-15 17:12 ` Jeremy Fitzhardinge
2008-08-11 18:10 ` Jeremy Fitzhardinge
2008-08-13 7:17 ` Jan Beulich
2008-08-04 19:36 ` Jeremy Fitzhardinge
2008-08-05 6:32 ` Jan Beulich
2008-08-05 7:33 ` Keir Fraser
2008-08-05 18:09 ` Jeremy Fitzhardinge [this message]
2008-08-06 7:15 ` Jan Beulich
2008-08-06 8:47 ` Jeremy Fitzhardinge
2008-08-06 9:35 ` Jan Beulich
2008-08-06 17:53 ` Jeremy Fitzhardinge
2008-08-06 20:21 ` Jeremy Fitzhardinge
2008-08-07 7:21 ` Jan Beulich
2008-08-07 15:47 ` Jeremy Fitzhardinge
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=4898976A.3080406@goop.org \
--to=jeremy@goop.org \
--cc=jbeulich@novell.com \
--cc=keir.fraser@eu.citrix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.