linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] perf/x86/intel: Disable check_msr for real hw
@ 2019-06-14 11:28 Jiri Olsa
  2019-06-14 13:33 ` Peter Zijlstra
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Jiri Olsa @ 2019-06-14 11:28 UTC (permalink / raw)
  To: Peter Zijlstra, Kan Liang
  Cc: Jiri Olsa, David Carrillo-Cisneros, Arnaldo Carvalho de Melo,
	lkml, Ingo Molnar, Namhyung Kim, Alexander Shishkin, Andi Kleen,
	Tom Vaden

hi,
the HPE server can do POST tracing and have enabled LBR
tracing during the boot, which makes check_msr fail falsly.

It looks like check_msr code was added only to check on guests
MSR access, would it be then ok to disable check_msr for real
hardware? (as in patch below)

We could also check if LBR tracing is enabled and make
appropriate checks, but this change is simpler ;-)

ideas? thanks,
jirka


---
 arch/x86/events/intel/core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 71001f005bfe..1194ae7e1992 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -20,6 +20,7 @@
 #include <asm/intel-family.h>
 #include <asm/apic.h>
 #include <asm/cpu_device_id.h>
+#include <asm/hypervisor.h>
 
 #include "../perf_event.h"
 
@@ -4050,6 +4051,13 @@ static bool check_msr(unsigned long msr, u64 mask)
 {
 	u64 val_old, val_new, val_tmp;
 
+	/*
+	 * Disable the check for real HW, so we don't
+	 * mess up with potentionaly enabled regs.
+	 */
+	if (hypervisor_is_type(X86_HYPER_NATIVE))
+		return true;
+
 	/*
 	 * Read the current value, change it and read it back to see if it
 	 * matches, this is needed to detect certain hardware emulators
-- 
2.21.0


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

end of thread, other threads:[~2019-06-24 18:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-14 11:28 [RFC] perf/x86/intel: Disable check_msr for real hw Jiri Olsa
2019-06-14 13:33 ` Peter Zijlstra
2019-06-14 13:45 ` Liang, Kan
2019-06-16 14:13   ` [PATCH] " Jiri Olsa
2019-06-16 20:56     ` Vaden, Tom (HPE Server OS Architecture)
2019-06-17 14:41     ` [tip:perf/core] perf/x86/intel: Disable check_msr for real HW tip-bot for Jiri Olsa
2019-06-21 17:48 ` [RFC] perf/x86/intel: Disable check_msr for real hw Andi Kleen
2019-06-23 22:40   ` Jiri Olsa
2019-06-23 23:44     ` Vaden, Tom (HPE Server OS Architecture)
2019-06-24  8:06     ` Paolo Bonzini
2019-06-24 16:46     ` Andi Kleen
2019-06-24 18:06       ` Jiri Olsa
2019-06-24 18:38         ` Andi Kleen
2019-06-24 18:49           ` Jiri Olsa

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).