From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751454AbbCTA3i (ORCPT ); Thu, 19 Mar 2015 20:29:38 -0400 Received: from mga14.intel.com ([192.55.52.115]:64403 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751128AbbCTA3d (ORCPT ); Thu, 19 Mar 2015 20:29:33 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,433,1422950400"; d="scan'208";a="682841758" From: Andi Kleen To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, Andi Kleen Subject: [PATCH 3/3] x86, perf: Trace rdpmc too Date: Thu, 19 Mar 2015 17:29:29 -0700 Message-Id: <1426811369-24565-4-git-send-email-andi@firstfloor.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1426811369-24565-1-git-send-email-andi@firstfloor.org> References: <1426811369-24565-1-git-send-email-andi@firstfloor.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen 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 --- 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 #include +#include + #include #include #include @@ -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