Thread (7 messages) 7 messages, 3 authors, 2024-07-15

RE: [PATCH v3] x86/paravirt: Disable virt spinlock on bare metal

From: "Zhuo, Qiuxu" <qiuxu.zhuo@intel.com>
Date: 2024-06-26 03:31:54
Also in: lkml

From: Nikolay Borisov <redacted>
[...]
quoted
quoted
Actually now shouldn't the CONFIG_PARAVIRT_SPINLOCKS check be
retained?
quoted
quoted
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 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help