Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S943426AbcJSOxV convert rfc822-to-8bit (ORCPT ); Wed, 19 Oct 2016 10:53:21 -0400 Received: from mga07.intel.com ([134.134.136.100]:5587 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S942157AbcJSOxS (ORCPT ); Wed, 19 Oct 2016 10:53:18 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,514,1473145200"; d="scan'208";a="891578957" From: "Odzioba, Lukasz" To: "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" , "peterz@infradead.org" , "bp@suse.de" , "dave.hansen@linux.intel.com" , "Liang, Kan" Subject: RE: [PATCH 1/1] x86/perf/intel/cstate: add C-state residency events for Knights Landing Thread-Topic: [PATCH 1/1] x86/perf/intel/cstate: add C-state residency events for Knights Landing Thread-Index: AQHSHlwYAveGdmj9c0S7V3awLX0OqKCvp4mQ Date: Wed, 19 Oct 2016 10:27:24 +0000 Message-ID: References: <1475598386-19597-1-git-send-email-lukasz.odzioba@intel.com> In-Reply-To: <1475598386-19597-1-git-send-email-lukasz.odzioba@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTRmNWZlMTQtMjdjMC00NTYxLTgyNzctMGU3MGRmOWNiZTI2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InNiVGRhd3RnZXZia2wxb295N2Jsd0MxS3FiMFl6dVBGK3Vjc3UzdnZRcHc9In0= x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3701 Lines: 100 On Tuesday, October 4, 2016 6:26 PM Odzioba, Lukasz wrote: > Although KNL does support C1,C6,PC2,PC3,PC6 states, the patch only > supports C6,PC2,PC3,PC6, because there is no counter for C1. > C6 residency counter MSR on KNL has a different address than other > platforms which is handled as a new quirk flag. > > Signed-off-by: Lukasz Odzioba > --- > arch/x86/events/intel/cstate.c | 30 ++++++++++++++++++++++++++---- > 1 file changed, 26 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c > index 3ca87b5..4f5ac72 100644 > --- a/arch/x86/events/intel/cstate.c > +++ b/arch/x86/events/intel/cstate.c > @@ -48,7 +48,8 @@ > * Scope: Core > * MSR_CORE_C6_RESIDENCY: CORE C6 Residency Counter > * perf code: 0x02 > - * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW,SKL > + * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW > + * SKL,KNL > * Scope: Core > * MSR_CORE_C7_RESIDENCY: CORE C7 Residency Counter > * perf code: 0x03 > @@ -56,15 +57,16 @@ > * Scope: Core > * MSR_PKG_C2_RESIDENCY: Package C2 Residency Counter. > * perf code: 0x00 > - * Available model: SNB,IVB,HSW,BDW,SKL > + * Available model: SNB,IVB,HSW,BDW,SKL,KNL > * Scope: Package (physical package) > * MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter. > * perf code: 0x01 > - * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL > + * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL > * Scope: Package (physical package) > * MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter. > * perf code: 0x02 > - * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW,SKL > + * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW > + * SKL,KNL > * Scope: Package (physical package) > * MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter. > * perf code: 0x03 > @@ -118,6 +120,7 @@ struct cstate_model { > > /* Quirk flags */ > #define SLM_PKG_C6_USE_C7_MSR (1UL << 0) > +#define KNL_CORE_C6_MSR (1UL << 1) > > struct perf_cstate_msr { > u64 msr; > @@ -488,6 +491,18 @@ static const struct cstate_model slm_cstates __initconst = { > .quirks = SLM_PKG_C6_USE_C7_MSR, > }; > > + > +static const struct cstate_model knl_cstates __initconst = { > + .core_events = BIT(PERF_CSTATE_CORE_C6_RES), > + > + .pkg_events = BIT(PERF_CSTATE_PKG_C2_RES) | > + BIT(PERF_CSTATE_PKG_C3_RES) | > + BIT(PERF_CSTATE_PKG_C6_RES), > + .quirks = KNL_CORE_C6_MSR, > +}; > + > + > + > #define X86_CSTATES_MODEL(model, states) \ > { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long) &(states) } > > @@ -523,6 +538,8 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = { > > X86_CSTATES_MODEL(INTEL_FAM6_SKYLAKE_MOBILE, snb_cstates), > X86_CSTATES_MODEL(INTEL_FAM6_SKYLAKE_DESKTOP, snb_cstates), > + > + X86_CSTATES_MODEL(INTEL_FAM6_XEON_PHI_KNL, knl_cstates), > { }, > }; > MODULE_DEVICE_TABLE(x86cpu, intel_cstates_match); > @@ -558,6 +575,11 @@ static int __init cstate_probe(const struct cstate_model *cm) > if (cm->quirks & SLM_PKG_C6_USE_C7_MSR) > pkg_msr[PERF_CSTATE_PKG_C6_RES].msr = MSR_PKG_C7_RESIDENCY; > > + /* KNL has different MSR for CORE C6 */ > + if (cm->quirks & KNL_CORE_C6_MSR) > + pkg_msr[PERF_CSTATE_CORE_C6_RES].msr = MSR_KNL_CORE_C6_RESIDENCY; > + > + > has_cstate_core = cstate_probe_msr(cm->core_events, > PERF_CSTATE_CORE_EVENT_MAX, > core_msr, core_events_attrs); > -- > 1.8.3.1 Any comments would be appreciated :) Thanks, Lukas