[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240516130244.893573-1-yu.c.chen@intel.com>
Date: Thu, 16 May 2024 21:02:44 +0800
From: Chen Yu <yu.c.chen@...el.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Juergen Gross <jgross@...e.com>,
Ajay Kaher <ajay.kaher@...adcom.com>,
Alexey Makhalov <alexey.amakhalov@...adcom.com>,
Arnd Bergmann <arnd@...db.de>,
"H. Peter Anvin" <hpa@...or.com>,
x86@...nel.org,
virtualization@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Chen Yu <yu.c.chen@...el.com>,
Qiuxu Zhuo <qiuxu.zhuo@...el.com>,
Prem Nath Dey <prem.nath.dey@...el.com>,
Xiaoping Zhou <xiaoping.zhou@...el.com>
Subject: [PATCH] x86/paravirt: Disable virt spinlock when CONFIG_PARAVIRT_SPINLOCKS disabled
Performance drop is reported when running encode/decode workload and
BenchSEE cache sub-workload.
Bisect points to commit ce0a1b608bfc ("x86/paravirt: Silence unused
native_pv_lock_init() function warning"). When CONFIG_PARAVIRT_SPINLOCKS
is disabled the virt_spin_lock_key is set to true on bare-metal.
The qspinlock degenerates to test-and-set spinlock, which decrease the
performance on bare-metal.
Fix this by disabling virt_spin_lock_key if CONFIG_PARAVIRT_SPINLOCKS
is not set, or it is on bare-metal.
Fixes: ce0a1b608bfc ("x86/paravirt: Silence unused native_pv_lock_init() function warning")
Suggested-by: Qiuxu Zhuo <qiuxu.zhuo@...el.com>
Reported-by: Prem Nath Dey <prem.nath.dey@...el.com>
Reported-by: Xiaoping Zhou <xiaoping.zhou@...el.com>
Signed-off-by: Chen Yu <yu.c.chen@...el.com>
---
arch/x86/kernel/paravirt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 5358d43886ad..ee51c0949ed8 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -55,7 +55,7 @@ DEFINE_STATIC_KEY_TRUE(virt_spin_lock_key);
void __init native_pv_lock_init(void)
{
- if (IS_ENABLED(CONFIG_PARAVIRT_SPINLOCKS) &&
+ if (!IS_ENABLED(CONFIG_PARAVIRT_SPINLOCKS) ||
!boot_cpu_has(X86_FEATURE_HYPERVISOR))
static_branch_disable(&virt_spin_lock_key);
}
--
2.25.1
Powered by blists - more mailing lists