All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] x86/perf/intel/cstate: add C-state residency events for Knights Landing
@ 2016-10-04 16:26 Lukasz Odzioba
  2016-10-19 10:27 ` Odzioba, Lukasz
  2016-10-19 15:24 ` [tip:perf/urgent] perf/x86/intel/cstate: Add " tip-bot for Lukasz Odzioba
  0 siblings, 2 replies; 3+ messages in thread
From: Lukasz Odzioba @ 2016-10-04 16:26 UTC (permalink / raw)
  To: linux-kernel, x86, tglx, mingo, hpa, peterz, bp, dave.hansen, kan.liang
  Cc: Lukasz Odzioba

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 <lukasz.odzioba@intel.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH 1/1] x86/perf/intel/cstate: add C-state residency events for Knights Landing
  2016-10-04 16:26 [PATCH 1/1] x86/perf/intel/cstate: add C-state residency events for Knights Landing Lukasz Odzioba
@ 2016-10-19 10:27 ` Odzioba, Lukasz
  2016-10-19 15:24 ` [tip:perf/urgent] perf/x86/intel/cstate: Add " tip-bot for Lukasz Odzioba
  1 sibling, 0 replies; 3+ messages in thread
From: Odzioba, Lukasz @ 2016-10-19 10:27 UTC (permalink / raw)
  To: linux-kernel, x86, tglx, mingo, hpa, peterz, bp, dave.hansen, Liang, Kan

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 <lukasz.odzioba@intel.com>
> ---
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:perf/urgent] perf/x86/intel/cstate: Add C-state residency events for Knights Landing
  2016-10-04 16:26 [PATCH 1/1] x86/perf/intel/cstate: add C-state residency events for Knights Landing Lukasz Odzioba
  2016-10-19 10:27 ` Odzioba, Lukasz
@ 2016-10-19 15:24 ` tip-bot for Lukasz Odzioba
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Lukasz Odzioba @ 2016-10-19 15:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, acme, jolsa, rafael.j.wysocki, vincent.weaver,
	lukasz.odzioba, hpa, tglx, linux-kernel, eranian, mingo,
	alexander.shishkin, torvalds

Commit-ID:  889882bce2a5f69242c1f3acd840983f467499b9
Gitweb:     http://git.kernel.org/tip/889882bce2a5f69242c1f3acd840983f467499b9
Author:     Lukasz Odzioba <lukasz.odzioba@intel.com>
AuthorDate: Tue, 4 Oct 2016 18:26:26 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 19 Oct 2016 15:52:16 +0200

perf/x86/intel/cstate: Add C-state residency events for Knights Landing

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 <lukasz.odzioba@intel.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: bp@suse.de
Cc: dave.hansen@linux.intel.com
Cc: kan.liang@intel.com
Link: http://lkml.kernel.org/r/1475598386-19597-1-git-send-email-lukasz.odzioba@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 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);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-19 15:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-04 16:26 [PATCH 1/1] x86/perf/intel/cstate: add C-state residency events for Knights Landing Lukasz Odzioba
2016-10-19 10:27 ` Odzioba, Lukasz
2016-10-19 15:24 ` [tip:perf/urgent] perf/x86/intel/cstate: Add " tip-bot for Lukasz Odzioba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.