2017-11-10 06:08:17

by Wanpeng Li

[permalink] [raw]
Subject: Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-10 0:00 GMT+08:00 Radim Krcmar <[email protected]>:
> 2017-11-09 20:43+0800, Wanpeng Li:
>> 2017-11-07 4:26 GMT+08:00 Eduardo Valentin <[email protected]>:
>> > Currently, the existing qspinlock implementation will fallback to
>> > test-and-set if the hypervisor has not set the PV_UNHALT flag.
>> >
>> > This patch gives the opportunity to guest kernels to select
>> > between test-and-set and the regular queueu fair lock implementation
>> > based on the PV_DEDICATED KVM feature flag. When the PV_DEDICATED
>> > flag is not set, the code will still fall back to test-and-set,
>> > but when the PV_DEDICATED flag is set, the code will use
>> > the regular queue spinlock implementation.
>> >
>> > With this patch, when in autoselect mode, the guest will
>> > use the default spinlock implementation based on host feature
>> > flags as follows:
>> >
>> > PV_DEDICATED = 1, PV_UNHALT = anything: default is qspinlock
>> > PV_DEDICATED = 0, PV_UNHALT = 1: default is pvqspinlock
>> > PV_DEDICATED = 0, PV_UNHALT = 0: default is tas
>> >
>> > Cc: Paolo Bonzini <[email protected]>
>> > Cc: "Radim Krčmář" <[email protected]>
>> > Cc: Jonathan Corbet <[email protected]>
>> > Cc: Thomas Gleixner <[email protected]>
>> > Cc: Ingo Molnar <[email protected]>
>> > Cc: "H. Peter Anvin" <[email protected]>
>> > Cc: [email protected]
>> > Cc: Peter Zijlstra <[email protected]>
>> > Cc: Waiman Long <[email protected]>
>> > Cc: [email protected]
>> > Cc: [email protected]
>> > Cc: [email protected]
>> > Cc: Jan H. Schoenherr <[email protected]>
>> > Cc: Anthony Liguori <[email protected]>
>> > Suggested-by: Matt Wilson <[email protected]>
>> > Signed-off-by: Eduardo Valentin <[email protected]>
>> > ---
>>
>> You should also add a cpuid flag in kvm part.
>
> It is better without that. The flag has no dependency on KVM (kernel
> hypervisor) code.

Do you mean -cpu host, +xxxx,I think it will result in "warning: host
doesn't support requested feature: CPUID.40000001H:eax.XXXXXX"

Regards,
Wanpeng Li

From 1583643075787967219@xxx Fri Nov 10 02:08:47 +0000 2017
X-GM-THRID: 1583352031107436177
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread