Waiman Long
2014-Mar-19 03:15 UTC
[PATCH v6 05/11] pvqspinlock, x86: Allow unfair spinlock in a PV guest
On 03/18/2014 04:14 AM, Paolo Bonzini wrote:> Il 17/03/2014 20:05, Konrad Rzeszutek Wilk ha scritto: >>> > Measurements were done by Gleb for two guests running 2.6.32 with 16 >>> > vcpus each, on a 16-core system. One guest ran with unfair locks, >>> > one guest ran with fair locks. Two kernel compilations ("time make >> And when you say fair locks are you saying PV ticketlocks or generic >> ticketlocks? > > Generic, of course. > >> You should see the same values with the PV ticketlock. It is not clear >> to me if this testing did include that variant of locks? > > Yes, PV is fine. But up to this point of the series, we are concerned > about spinlock performance when running on an overcommitted hypervisor > that doesn't support PV spinlocks.The unfair queue lock is designed in such a way that it will only be activated when running in a PV guest or it won't be mergeable upstream. So there must be some way to determine if it is running under a hypervisor. -Longman
Paolo Bonzini
2014-Mar-19 10:07 UTC
[PATCH v6 05/11] pvqspinlock, x86: Allow unfair spinlock in a PV guest
Il 19/03/2014 04:15, Waiman Long ha scritto:>>> You should see the same values with the PV ticketlock. It is not clear >>> to me if this testing did include that variant of locks? >> >> Yes, PV is fine. But up to this point of the series, we are concerned >> about spinlock performance when running on an overcommitted hypervisor >> that doesn't support PV spinlocks. > > The unfair queue lock is designed in such a way that it will only be > activated when running in a PV guest or it won't be mergeable upstream. > So there must be some way to determine if it is running under a hypervisor.Exactly. What you want is boot_cpu_has(X86_FEATURE_HYPERVISOR). Paolo
Waiman Long
2014-Mar-19 16:58 UTC
[PATCH v6 05/11] pvqspinlock, x86: Allow unfair spinlock in a PV guest
On 03/19/2014 06:07 AM, Paolo Bonzini wrote:> Il 19/03/2014 04:15, Waiman Long ha scritto: >>>> You should see the same values with the PV ticketlock. It is not clear >>>> to me if this testing did include that variant of locks? >>> >>> Yes, PV is fine. But up to this point of the series, we are concerned >>> about spinlock performance when running on an overcommitted hypervisor >>> that doesn't support PV spinlocks. >> >> The unfair queue lock is designed in such a way that it will only be >> activated when running in a PV guest or it won't be mergeable upstream. >> So there must be some way to determine if it is running under a >> hypervisor. > > Exactly. What you want is boot_cpu_has(X86_FEATURE_HYPERVISOR). > > PaoloThe unfair lock is to be enabled by boot time check, not just by the presence of a configuration macro during the build process in order to avoid using unfair lock on bare metal. Of course, Linux distros can modify this if that suits their need. -Longman
Apparently Analagous Threads
- [PATCH v6 05/11] pvqspinlock, x86: Allow unfair spinlock in a PV guest
- [PATCH v6 05/11] pvqspinlock, x86: Allow unfair spinlock in a PV guest
- [PATCH v6 05/11] pvqspinlock, x86: Allow unfair spinlock in a PV guest
- [PATCH v7 06/11] pvqspinlock, x86: Allow unfair queue spinlock in a KVM guest
- [PATCH v7 06/11] pvqspinlock, x86: Allow unfair queue spinlock in a KVM guest