[lkml]   [2017]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock
On 05/09/17 10:28, Peter Zijlstra wrote:
> 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.

So in fact we want a "always false" shortcut for bare metal and for any
virtualization environment selecting bare metal behavior.

I'll have a try.


 \ /
  Last update: 2017-09-05 10:53    [W:0.071 / U:2.420 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site