[PATCH 26/31] perf, x86: Support for printing PMU state on spurious PMIs

From: Andi Kleen
Date: Fri Sep 28 2012 - 00:38:40 EST


From: Andi Kleen <ak@xxxxxxxxxxxxxxx>

I had some problems with spurious PMIs, so print the PMU state
on a spurious one. This will not interact well with other NMI users.
Disabled by default, has to be explicitely enabled through sysfs.

Optional, but useful for debugging.

Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
---
arch/x86/kernel/cpu/perf_event_intel.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index be0d3c8..baf78e0 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -12,6 +12,7 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/export.h>
+#include <linux/moduleparam.h>

#include <asm/cpufeature.h>
#include <asm/hardirq.h>
@@ -19,6 +20,9 @@

#include "perf_event.h"

+static bool print_spurious_pmi __read_mostly;
+module_param(print_spurious_pmi, bool, 0644);
+
/*
* Intel PerfMon, used on Core and later.
*/
@@ -1237,6 +1241,10 @@ again:
goto again;

done:
+ if (!handled && print_spurious_pmi) {
+ pr_debug("Spurious PMI\n");
+ perf_event_print_debug();
+ }
intel_pmu_enable_all(0);
return handled;
}
--
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/