Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753288AbcD2EwM (ORCPT ); Fri, 29 Apr 2016 00:52:12 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:36272 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752950AbcD2Eqb (ORCPT ); Fri, 29 Apr 2016 00:46:31 -0400 From: David Carrillo-Cisneros To: Peter Zijlstra , Alexander Shishkin , Arnaldo Carvalho de Melo , Ingo Molnar Cc: Vikas Shivappa , Matt Fleming , Tony Luck , Stephane Eranian , Paul Turner , David Carrillo-Cisneros , x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/32] perf/x86/intel/cqm: separate CQM PMU's attributes from x86 PMU Date: Thu, 28 Apr 2016 21:43:13 -0700 Message-Id: <1461905018-86355-8-git-send-email-davidcc@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1461905018-86355-1-git-send-email-davidcc@google.com> References: <1461905018-86355-1-git-send-email-davidcc@google.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1823 Lines: 46 Create a CQM_EVENT_ATTR_STR to use in CQM to remove dependency on the unrelated x86's PMU EVENT_ATTR_STR. Reviewed-by: Stephane Eranian Signed-off-by: David Carrillo-Cisneros --- arch/x86/events/intel/cqm.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/arch/x86/events/intel/cqm.c b/arch/x86/events/intel/cqm.c index 8457dd0..d5eac8f 100644 --- a/arch/x86/events/intel/cqm.c +++ b/arch/x86/events/intel/cqm.c @@ -38,6 +38,13 @@ static inline void __update_pqr_rmid(u32 rmid) static DEFINE_MUTEX(cache_mutex); static DEFINE_RAW_SPINLOCK(cache_lock); +#define CQM_EVENT_ATTR_STR(_name, v, str) \ +static struct perf_pmu_events_attr event_attr_##v = { \ + .attr = __ATTR(_name, 0444, perf_event_sysfs_show, NULL), \ + .id = 0, \ + .event_str = str, \ +} + /* * Groups of events that have the same target(s), one RMID per group. */ @@ -504,11 +511,11 @@ static int intel_cqm_event_init(struct perf_event *event) return 0; } -EVENT_ATTR_STR(llc_occupancy, intel_cqm_llc, "event=0x01"); -EVENT_ATTR_STR(llc_occupancy.per-pkg, intel_cqm_llc_pkg, "1"); -EVENT_ATTR_STR(llc_occupancy.unit, intel_cqm_llc_unit, "Bytes"); -EVENT_ATTR_STR(llc_occupancy.scale, intel_cqm_llc_scale, NULL); -EVENT_ATTR_STR(llc_occupancy.snapshot, intel_cqm_llc_snapshot, "1"); +CQM_EVENT_ATTR_STR(llc_occupancy, intel_cqm_llc, "event=0x01"); +CQM_EVENT_ATTR_STR(llc_occupancy.per-pkg, intel_cqm_llc_pkg, "1"); +CQM_EVENT_ATTR_STR(llc_occupancy.unit, intel_cqm_llc_unit, "Bytes"); +CQM_EVENT_ATTR_STR(llc_occupancy.scale, intel_cqm_llc_scale, NULL); +CQM_EVENT_ATTR_STR(llc_occupancy.snapshot, intel_cqm_llc_snapshot, "1"); static struct attribute *intel_cqm_events_attr[] = { EVENT_PTR(intel_cqm_llc), -- 2.8.0.rc3.226.g39d4020