> From: Nikolay Borisov <nik.borisov@xxxxxxxx> > [...] > >> Actually now shouldn't the CONFIG_PARAVIRT_SPINLOCKS check be > retained? > >> Otherwise we'll have the virtspinlock enabled even if we are a guest > >> but CONFIG_PARAVIRT_SPINLOCKS is disabled, no ? > >> > > > > It seems to be the expected behavior? If CONFIG_PARAVIRT_SPINLOCKS is > > disabled, should the virt_spin_lock_key be enabled in the guest? > > No, but if it's disabled and we are under a hypervisor shouldn't the virt > spinlock be kept disabled? No, the virt_spin_lock_key shouldn't be kept disabled. According to the comments [1], in the hypervisor if CONFIG_PARAVIRT_SPINLOCKS is disabled, the virt_spin_lock_key should be enabled to fall back to the TAS spinlock. [1] https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/qspinlock.h#L94 According to the comments [2]: So my understanding is that in hypervisor keeping virt_spin_lock_key enabled allows the spinlock fallback to TAS if PV spinlock is not supported (either CONFIG_PARAVIRT_SPINLOCKS=n or the host doesn't support the PV feature) [2] https://github.com/torvalds/linux/blob/master/arch/x86/kernel/kvm.c#L1073 > As it stands now everytime we are under a > hypervisor the virt spinlock is enabled irrespective of the PARAVIRT_SPINLOCK > config state. According to [1] [2], yes, I think so, -Qiuxu