Skip to content

Commit 5ea3f6f

Browse files
Zhenzhong DuanIngo Molnar
authored andcommitted
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 d0e1a50 ("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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Juergen Gross <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 3b238a6 commit 5ea3f6f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/x86/events/intel/core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <asm/intel-family.h>
2121
#include <asm/apic.h>
2222
#include <asm/cpu_device_id.h>
23-
#include <asm/hypervisor.h>
2423

2524
#include "../perf_event.h"
2625

@@ -4053,7 +4052,7 @@ static bool check_msr(unsigned long msr, u64 mask)
40534052
* Disable the check for real HW, so we don't
40544053
* mess with potentionaly enabled registers:
40554054
*/
4056-
if (hypervisor_is_type(X86_HYPER_NATIVE))
4055+
if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
40574056
return true;
40584057

40594058
/*

0 commit comments

Comments
 (0)