public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Jan Beulich <JBeulich@novell.com>,
	"mingo@elte.hu" <mingo@elte.hu>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	ksrinivasan <ksrinivasan@novell.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>
Subject: Re: [PATCH 1/4, v2] x86: enlightenment for ticket spin locks - base implementation
Date: Wed, 30 Jun 2010 11:56:14 +0200	[thread overview]
Message-ID: <4C2B14BE.6080505@goop.org> (raw)
In-Reply-To: <1277889116.1868.95.camel@laptop>

On 06/30/2010 11:11 AM, Peter Zijlstra wrote:
> On Wed, 2010-06-30 at 10:00 +0100, Jan Beulich wrote:
>   
>>>>> On 30.06.10 at 10:05, Peter Zijlstra <peterz@infradead.org> wrote:
>>>>>           
>>> On Tue, 2010-06-29 at 15:31 +0100, Jan Beulich wrote:
>>>       
>>>> Add optional (alternative instructions based) callout hooks to the
>>>> contended ticket lock and the ticket unlock paths, to allow hypervisor
>>>> specific code to be used for reducing/eliminating the bad effects
>>>> ticket locks have on performance when running virtualized.
>>>>         
>>> Uhm, I'd much rather see a single alternative implementation, not a
>>> per-hypervisor lock implementation.
>>>       
>> How would you imaging this to work? I can't see how the mechanism
>> could be hypervisor agnostic. Just look at the Xen implementation
>> (patch 2) - do you really see room for meaningful abstraction there?
>>     
> I tried not to, it made my eyes bleed.. 
>
> But from what I hear all virt people are suffering from spinlocks (and
> fair spinlocks in particular), so I was thinking it'd be a good idea to
> get all interested parties to collaborate on one. Fragmentation like
> this hardly ever works out well.
>   

The fastpath of the spinlocks can be common, but if it ends up spinning
too long (however that might be defined), then it needs to call out to a
hypervisor-specific piece of code which is effectively "yield this vcpu
until its worth trying again".  In Xen we can set up an event channel
that the waiting CPU can block on, and the current lock holder can
tickle it when it releases the lock (ideally it would just tickle the
CPU with the next ticket, but that's a further refinement).

I'm not sure what the corresponding implementation for KVM or HyperV
would look like.  Modern Intel chips have a "do a VMEXIT if you've run
pause in a tight loop for too long" feature, which deals with the
"spinning too long" part, but I'm not sure about the blocking mechanism
(something based on monitor/mwait perhaps).

    J

  reply	other threads:[~2010-06-30  9:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-29 14:31 [PATCH 1/4, v2] x86: enlightenment for ticket spin locks - base implementation Jan Beulich
2010-06-30  8:05 ` Peter Zijlstra
2010-06-30  9:00   ` Jan Beulich
2010-06-30  9:11     ` Peter Zijlstra
2010-06-30  9:56       ` Jeremy Fitzhardinge [this message]
2010-06-30 11:43         ` Jan Beulich
2010-06-30 11:48           ` Peter Zijlstra
2010-06-30 11:54             ` Jan Beulich
2010-06-30 10:50       ` Jeremy Fitzhardinge
2010-06-30 11:52         ` Jan Beulich
2010-06-30 12:53           ` Jeremy Fitzhardinge
2010-06-30 13:21             ` Jan Beulich
2010-06-30 13:28               ` Jeremy Fitzhardinge
2010-06-30  9:26   ` Peter Zijlstra
2010-06-30  9:32     ` Gleb Natapov
2010-06-30  8:24 ` Peter Zijlstra

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=4C2B14BE.6080505@goop.org \
    --to=jeremy@goop.org \
    --cc=JBeulich@novell.com \
    --cc=hpa@zytor.com \
    --cc=ksrinivasan@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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