linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Juergen Gross <jgross@suse.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
	Oscar Salvador <osalvador@suse.de>,
	Ingo Molnar <mingo@kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	linux-doc@vger.kernel.org, Waiman Long <longman@redhat.com>
Subject: Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock
Date: Tue, 5 Sep 2017 10:28:01 +0200	[thread overview]
Message-ID: <20170905082801.d3sr7hdjz6lpon5p@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <83ac209b-0807-0a72-cd07-d4ccd1d1ed61@suse.com>

On Tue, Sep 05, 2017 at 10:14:21AM +0200, Juergen Gross wrote:
> On 05/09/17 10:10, Peter Zijlstra wrote:
> > On Tue, Sep 05, 2017 at 09:35:40AM +0200, Juergen Gross wrote:
> >>> So the problem with qspinlock is that it will revert to a classic
> >>> test-and-set spinlock if you don't do paravirt but are running a HV.
> >>
> >> In the Xen case we just use the bare metal settings when xen_nopvspin
> >> has been specified. So paravirt, but without modifying any pv_lock_ops
> >> functions.
> > 
> > See arch/x86/include/asm/qspinlock.h:virt_spin_lock(). Unless you clear
> > X86_FEATURE_HYPERVISOR you get a test-and-set spinlock.
> > 
> > And as the comment there says, this is a fallback for !paravirt enabled
> > hypervisors to avoid the worst of the lock holder preemption crud.
> > 
> > But this very much does not deal with the 1:1 case nicely.
> > 
> 
> Aah, now I've got it.
> 
> So maybe we should add virt_spin_lock() to pv_lock_ops? This way e.g.
> xen_nopvspin could tweak just the virt_spin_lock() case by letting it
> return false all the time?

Hmm, that might work. Could we somehow nop that call when
!X86_FEATURE_HYPERVISOR?, that saves native from having to do the call
and would be a win for everyone.

  reply	other threads:[~2017-09-05  8:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-04 14:28 [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Oscar Salvador
2017-09-04 14:40 ` Peter Zijlstra
2017-09-04 19:32   ` Waiman Long
2017-09-04 22:21   ` Davidlohr Bueso
2017-09-05  6:28     ` Juergen Gross
2017-09-05  6:57       ` Oscar Salvador
2017-09-05  8:07         ` Peter Zijlstra
2017-09-05  6:58       ` Peter Zijlstra
2017-09-05  7:35         ` Juergen Gross
2017-09-05  8:10           ` Peter Zijlstra
2017-09-05  8:14             ` Juergen Gross
2017-09-05  8:28               ` Peter Zijlstra [this message]
2017-09-05  8:52                 ` Juergen Gross
2017-09-05  9:03                   ` Peter Zijlstra
2017-09-05  9:11                     ` Juergen Gross

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=20170905082801.d3sr7hdjz6lpon5p@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=dave@stgolabs.net \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@kernel.org \
    --cc=osalvador@suse.de \
    --cc=pbonzini@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).