All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/speculation/mds: Apply more accurate check on hypervisor platform
@ 2019-07-25  2:39 Zhenzhong Duan
  2019-07-25 10:55 ` [tip:x86/urgent] " tip-bot for Zhenzhong Duan
  0 siblings, 1 reply; 2+ messages in thread
From: Zhenzhong Duan @ 2019-07-25  2:39 UTC (permalink / raw)
  To: linux-kernel
  Cc: x86, Zhenzhong Duan, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Juergen Gross, Boris Ostrovsky

X86_HYPER_NATIVE isn't accurate for checking if running on native
platform, e.g. CONFIG_HYPERVISOR_GUEST isn't set or "nopv" is enabled.

Checking cpu flag X86_FEATURE_HYPERVISOR to determine if it's running
on native platform is more accurate.

This still doesn't consider the old platform where even
X86_FEATURE_HYPERVISOR is unsupported, e.g. vmware.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Juergen Gross <jgross@suse.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
 arch/x86/kernel/cpu/bugs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 66ca906..801ecd1 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -1226,7 +1226,7 @@ static ssize_t l1tf_show_state(char *buf)
 
 static ssize_t mds_show_state(char *buf)
 {
-	if (!hypervisor_is_type(X86_HYPER_NATIVE)) {
+	if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) {
 		return sprintf(buf, "%s; SMT Host state unknown\n",
 			       mds_strings[mds_mitigation]);
 	}
-- 
1.8.3.1


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

* [tip:x86/urgent] x86/speculation/mds: Apply more accurate check on hypervisor platform
  2019-07-25  2:39 [PATCH] x86/speculation/mds: Apply more accurate check on hypervisor platform Zhenzhong Duan
@ 2019-07-25 10:55 ` tip-bot for Zhenzhong Duan
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Zhenzhong Duan @ 2019-07-25 10:55 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: tglx, mingo, zhenzhong.duan, hpa, linux-kernel

Commit-ID:  517c3ba00916383af6411aec99442c307c23f684
Gitweb:     https://git.kernel.org/tip/517c3ba00916383af6411aec99442c307c23f684
Author:     Zhenzhong Duan <zhenzhong.duan@oracle.com>
AuthorDate: Thu, 25 Jul 2019 10:39:09 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 25 Jul 2019 12:51:55 +0200

x86/speculation/mds: Apply more accurate check on hypervisor platform

X86_HYPER_NATIVE isn't accurate for checking if running on native platform,
e.g. CONFIG_HYPERVISOR_GUEST isn't set or "nopv" is enabled.

Checking the CPU feature bit X86_FEATURE_HYPERVISOR to determine if it's
running on native platform is more accurate.

This still doesn't cover the platforms on which X86_FEATURE_HYPERVISOR is
unsupported, e.g. VMware, but there is nothing which can be done about this
scenario.

Fixes: 8a4b06d391b0 ("x86/speculation/mds: Add sysfs reporting for MDS")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/1564022349-17338-1-git-send-email-zhenzhong.duan@oracle.com
---
 arch/x86/kernel/cpu/bugs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 66ca906aa790..801ecd1c3fd5 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -1226,7 +1226,7 @@ static ssize_t l1tf_show_state(char *buf)
 
 static ssize_t mds_show_state(char *buf)
 {
-	if (!hypervisor_is_type(X86_HYPER_NATIVE)) {
+	if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) {
 		return sprintf(buf, "%s; SMT Host state unknown\n",
 			       mds_strings[mds_mitigation]);
 	}

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

end of thread, other threads:[~2019-07-25 10:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25  2:39 [PATCH] x86/speculation/mds: Apply more accurate check on hypervisor platform Zhenzhong Duan
2019-07-25 10:55 ` [tip:x86/urgent] " tip-bot for Zhenzhong Duan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.