linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/speculation/mds: Avoid clearing CPU buffers in native machine with old microcode
@ 2019-06-23  3:35 Zhenzhong Duan
  2019-06-23  3:35 ` [PATCH v2] x86/speculation/mds: Eliminate leaks by trace_hardirqs_on() Zhenzhong Duan
  0 siblings, 1 reply; 3+ messages in thread
From: Zhenzhong Duan @ 2019-06-23  3:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, mingo, bp, x86, hpa, jgross, ndesaulniers, gregkh, Zhenzhong Duan

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@oracle.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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-26 13:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-23  3:35 [PATCH] x86/speculation/mds: Avoid clearing CPU buffers in native machine with old microcode Zhenzhong Duan
2019-06-23  3:35 ` [PATCH v2] x86/speculation/mds: Eliminate leaks by trace_hardirqs_on() Zhenzhong Duan
2019-06-26 13:07   ` [tip:x86/pti] " tip-bot for Zhenzhong Duan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).