From: Andi Kleen <[email protected]> perf uses RDPMC to read the performance counters, so it's useful to trace that too. Add a trace point for RDPMC too, similar to the existing MSR ones. Since there is only a single call of rdpmc in the whole kernel (in perf) just add the trace statement to that call, instead of moving the rdpmcl inline out of line.
Signed-off-by: Andi Kleen <[email protected]> --- arch/x86/kernel/cpu/perf_event.c | 3 +++ include/trace/events/msr.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index e0dab5c..9644d95 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c @@ -26,6 +26,8 @@ #include <linux/bitops.h> #include <linux/device.h> +#include <trace/events/msr.h> + #include <asm/apic.h> #include <asm/stacktrace.h> #include <asm/nmi.h> @@ -82,6 +84,7 @@ u64 x86_perf_event_update(struct perf_event *event) again: prev_raw_count = local64_read(&hwc->prev_count); rdpmcl(hwc->event_base_rdpmc, new_raw_count); + trace_rdpmc(hwc->event_base_rdpmc, new_raw_count, 0); if (local64_cmpxchg(&hwc->prev_count, prev_raw_count, new_raw_count) != prev_raw_count) diff --git a/include/trace/events/msr.h b/include/trace/events/msr.h index e1677e8..4fa81b5 100644 --- a/include/trace/events/msr.h +++ b/include/trace/events/msr.h @@ -40,6 +40,12 @@ DEFINE_EVENT(msr_trace_class, write_msr, TP_ARGS(msr, val, failed) ); +DEFINE_EVENT(msr_trace_class, rdpmc, + TP_PROTO(unsigned msr, u64 val, int failed), + TP_ARGS(msr, val, failed) +); + + #endif /* _TRACE_MSR_H */ /* This part must be outside protection */ -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

