[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CY8PR11MB7134C965E373B3711ABF182389D62@CY8PR11MB7134.namprd11.prod.outlook.com>
Date: Wed, 26 Jun 2024 03:31:50 +0000
From: "Zhuo, Qiuxu" <qiuxu.zhuo@...el.com>
To: Nikolay Borisov <nik.borisov@...e.com>, "Chen, Yu C" <yu.c.chen@...el.com>
CC: Dave Hansen <dave.hansen@...ux.intel.com>, Thomas Gleixner
<tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov
<bp@...en8.de>, "x86@...nel.org" <x86@...nel.org>, "H. Peter Anvin"
<hpa@...or.com>, Arnd Bergmann <arnd@...db.de>,
"virtualization@...ts.linux.dev" <virtualization@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Juergen Gross
<jgross@...e.com>, Chen Yu <yu.chen.surf@...il.com>, "Dey, Prem Nath"
<prem.nath.dey@...el.com>, "Zhou, Xiaoping" <xiaoping.zhou@...el.com>
Subject: RE: [PATCH v3] x86/paravirt: Disable virt spinlock on bare metal
> From: Nikolay Borisov <nik.borisov@...e.com>
> [...]
> >> 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
Powered by blists - more mailing lists