[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1561260904-29669-1-git-send-email-zhenzhong.duan@oracle.com>
Date: Sun, 23 Jun 2019 11:35:03 +0800
From: Zhenzhong Duan <zhenzhong.duan@...cle.com>
To: linux-kernel@...r.kernel.org
Cc: tglx@...utronix.de, mingo@...nel.org, bp@...en8.de, x86@...nel.org,
hpa@...or.com, jgross@...e.com, ndesaulniers@...gle.com,
gregkh@...uxfoundation.org,
Zhenzhong Duan <zhenzhong.duan@...cle.com>
Subject: [PATCH] x86/speculation/mds: Avoid clearing CPU buffers in native machine with old microcode
Commit 22dd8365088b ("x86/speculation/mds: Add mitigation mode VMWERV") add
an internal mitigation mode VWWERV which enables the invocation of the CPU
buffer clearing even if X86_FEATURE_MD_CLEAR is not set.
This wastes a few CPU cycles for native machine with an old microcode
unnecessorily. Avoid it by checking if it's running in native machine.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@...cle.com>
---
arch/x86/kernel/cpu/bugs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 03b4cc0..03f5a77 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -233,7 +233,9 @@ static void x86_amd_ssb_disable(void)
static void __init mds_select_mitigation(void)
{
- if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off()) {
+ if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off() ||
+ (hypervisor_is_type(X86_HYPER_NATIVE) &&
+ !boot_cpu_has(X86_FEATURE_MD_CLEAR))) {
mds_mitigation = MDS_MITIGATION_OFF;
return;
}
--
1.8.3.1
Powered by blists - more mailing lists