* [PATCH] perf/x86: Apply more accurate check on hypervisor platform
@ 2019-07-25 2:39 Zhenzhong Duan
2019-07-25 7:46 ` Peter Zijlstra
2019-07-25 16:07 ` [tip:perf/urgent] " tip-bot for Zhenzhong Duan
0 siblings, 2 replies; 3+ messages in thread
From: Zhenzhong Duan @ 2019-07-25 2:39 UTC (permalink / raw)
To: linux-kernel
Cc: x86, Zhenzhong Duan, Peter Zijlstra, Arnaldo Carvalho de Melo,
Alexander Shishkin, Jiri Olsa, Namhyung Kim, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, Juergen Gross, Boris Ostrovsky
check_msr is used to fix a bug report in guest where KVM doesn't support
LBR MSR and cause #GP.
The msr check is bypassed on real HW to workaround a false failure,
see commit d0e1a507bdc7 ("perf/x86/intel: Disable check_msr for real HW")
When running a guest with CONFIG_HYPERVISOR_GUEST not set or "nopv"
enabled, current check isn't enough and #GP could trigger.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
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/events/intel/core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 9e911a9..86f3656 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -20,7 +20,6 @@
#include <asm/intel-family.h>
#include <asm/apic.h>
#include <asm/cpu_device_id.h>
-#include <asm/hypervisor.h>
#include "../perf_event.h"
@@ -4053,7 +4052,7 @@ static bool check_msr(unsigned long msr, u64 mask)
* Disable the check for real HW, so we don't
* mess with potentionaly enabled registers:
*/
- if (hypervisor_is_type(X86_HYPER_NATIVE))
+ if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
return true;
/*
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf/x86: Apply more accurate check on hypervisor platform
2019-07-25 2:39 [PATCH] perf/x86: Apply more accurate check on hypervisor platform Zhenzhong Duan
@ 2019-07-25 7:46 ` Peter Zijlstra
2019-07-25 16:07 ` [tip:perf/urgent] " tip-bot for Zhenzhong Duan
1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2019-07-25 7:46 UTC (permalink / raw)
To: Zhenzhong Duan
Cc: linux-kernel, x86, Arnaldo Carvalho de Melo, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Juergen Gross, Boris Ostrovsky
On Thu, Jul 25, 2019 at 10:39:26AM +0800, Zhenzhong Duan wrote:
> check_msr is used to fix a bug report in guest where KVM doesn't support
> LBR MSR and cause #GP.
>
> The msr check is bypassed on real HW to workaround a false failure,
> see commit d0e1a507bdc7 ("perf/x86/intel: Disable check_msr for real HW")
>
> When running a guest with CONFIG_HYPERVISOR_GUEST not set or "nopv"
> enabled, current check isn't enough and #GP could trigger.
>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> 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>
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/urgent] perf/x86: Apply more accurate check on hypervisor platform
2019-07-25 2:39 [PATCH] perf/x86: Apply more accurate check on hypervisor platform Zhenzhong Duan
2019-07-25 7:46 ` Peter Zijlstra
@ 2019-07-25 16:07 ` tip-bot for Zhenzhong Duan
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Zhenzhong Duan @ 2019-07-25 16:07 UTC (permalink / raw)
To: linux-tip-commits
Cc: jgross, jolsa, zhenzhong.duan, acme, alexander.shishkin, peterz,
torvalds, boris.ostrovsky, tglx, hpa, linux-kernel, bp, mingo,
namhyung
Commit-ID: 5ea3f6fb37b79da33ac9211df336fd2b9f47c39f
Gitweb: https://git.kernel.org/tip/5ea3f6fb37b79da33ac9211df336fd2b9f47c39f
Author: Zhenzhong Duan <zhenzhong.duan@oracle.com>
AuthorDate: Thu, 25 Jul 2019 10:39:26 +0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 25 Jul 2019 15:41:30 +0200
perf/x86: Apply more accurate check on hypervisor platform
check_msr is used to fix a bug report in guest where KVM doesn't support
LBR MSR and cause #GP.
The msr check is bypassed on real HW to workaround a false failure,
see commit d0e1a507bdc7 ("perf/x86/intel: Disable check_msr for real HW")
When running a guest with CONFIG_HYPERVISOR_GUEST not set or "nopv"
enabled, current check isn't enough and #GP could trigger.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/1564022366-18293-1-git-send-email-zhenzhong.duan@oracle.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/events/intel/core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index b35519cbc8b4..c9075fc75cb6 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -20,7 +20,6 @@
#include <asm/intel-family.h>
#include <asm/apic.h>
#include <asm/cpu_device_id.h>
-#include <asm/hypervisor.h>
#include "../perf_event.h"
@@ -4053,7 +4052,7 @@ static bool check_msr(unsigned long msr, u64 mask)
* Disable the check for real HW, so we don't
* mess with potentionaly enabled registers:
*/
- if (hypervisor_is_type(X86_HYPER_NATIVE))
+ if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
return true;
/*
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-25 16:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-25 2:39 [PATCH] perf/x86: Apply more accurate check on hypervisor platform Zhenzhong Duan
2019-07-25 7:46 ` Peter Zijlstra
2019-07-25 16:07 ` [tip:perf/urgent] " 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