All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2] Skylake PSys support
@ 2016-04-17 22:02 Srinivas Pandruvada
  2016-04-17 22:03 ` [PATCH v4 1/2] perf/x86/intel/rapl: support Skylake RAPL domains Srinivas Pandruvada
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Srinivas Pandruvada @ 2016-04-17 22:02 UTC (permalink / raw)
  To: tglx, mingo, hpa, rjw
  Cc: x86, peterz, bp, linux-kernel, jacob.jun.pan, linux-pm,
	Srinivas Pandruvada

Skylake processor supports a new set of RAPL registers for controlling
entire SoC instead of just CPU package called PSys. This change adds
support in two sub systems:

x86/perf: Adds basic support for Skylake RAPL and PSys support

powercap/rapl: A new platform domain to the current power capping Intel
RAPL driver.

v4
Perf:
- Rebased the patch as msr-index file changed.
- Added a new Skylake H/L model
- Changed RAPL_IDX_SKL to RAPL_IDX_SKL_CLN to avoid clash
with SKL server domain once we add SKL server support

Powercap/rapl:
- Fix kbuild test robot compliant about invalid domain error in dmesg

v3:
As suggested by tglx adding support first in perf-rapl.
Perf RAPL was missing RAPL support for Skylake
Added support including Psys

v2:
Moved PSYS MSR defines to intel_rapl.c as suggested by Boris

Srinivas Pandruvada (2):
  perf/x86/intel/rapl: support Skylake RAPL domains
  powercap: intel_rapl: PSys support

 arch/x86/events/intel/rapl.c     | 51 +++++++++++++++++++++++++++--
 arch/x86/include/asm/msr-index.h |  2 ++
 drivers/powercap/intel_rapl.c    | 69 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 120 insertions(+), 2 deletions(-)

-- 
1.9.1

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

* [PATCH v4 1/2] perf/x86/intel/rapl: support Skylake RAPL domains
  2016-04-17 22:02 [PATCH v4 0/2] Skylake PSys support Srinivas Pandruvada
@ 2016-04-17 22:03 ` Srinivas Pandruvada
  2016-04-20 15:43   ` Peter Zijlstra
  2016-04-23 12:55   ` [tip:perf/core] perf/x86/intel/rapl: Support " tip-bot for Srinivas Pandruvada
  2016-04-17 22:03 ` [PATCH v4 2/2] powercap: intel_rapl: PSys support Srinivas Pandruvada
  2016-04-20 13:59 ` [PATCH v4 0/2] Skylake " Peter Zijlstra
  2 siblings, 2 replies; 12+ messages in thread
From: Srinivas Pandruvada @ 2016-04-17 22:03 UTC (permalink / raw)
  To: tglx, mingo, hpa, rjw
  Cc: x86, peterz, bp, linux-kernel, jacob.jun.pan, linux-pm,
	Srinivas Pandruvada

Added Skylake client support for RAPL domains. In addition to RAPL domains
in Broadwell clients, it has support for platform domain (aka PSys). The
PSys domain controls entire SoC instead of just CPU package. Unlike
package domain, PSys support requires more than just processor level
implementation. The other parts in the system need additional HW level
signaling, which OEMs needs to support. When not supported, the energy
counter register in PSys domain returns 0.

Also corrected error in comment for gpu counter, which previously was
dram counter.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com
---
 arch/x86/events/intel/rapl.c     | 51 ++++++++++++++++++++++++++++++++++++++--
 arch/x86/include/asm/msr-index.h |  2 ++
 2 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index c83c141..3748fbd 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -27,10 +27,14 @@
  *	  event: rapl_energy_dram
  *    perf code: 0x3
  *
- * dram counter: consumption of the builtin-gpu domain (client only)
+ * gpu counter: consumption of the builtin-gpu domain (client only)
  *	  event: rapl_energy_gpu
  *    perf code: 0x4
  *
+ *  psys counter: consumption of the builtin-psys domain (client only)
+ *	  event: rapl_energy_psys
+ *    perf code: 0x5
+ *
  * We manage those counters as free running (read-only). They may be
  * use simultaneously by other tools, such as turbostat.
  *
@@ -64,13 +68,16 @@
 #define INTEL_RAPL_RAM		0x3	/* pseudo-encoding */
 #define RAPL_IDX_PP1_NRG_STAT	3	/* gpu */
 #define INTEL_RAPL_PP1		0x4	/* pseudo-encoding */
+#define RAPL_IDX_PSYS_NRG_STAT	4	/* psys */
+#define INTEL_RAPL_PSYS		0x5	/* pseudo-encoding */
 
-#define NR_RAPL_DOMAINS         0x4
+#define NR_RAPL_DOMAINS         0x5
 static const char *const rapl_domain_names[NR_RAPL_DOMAINS] __initconst = {
 	"pp0-core",
 	"package",
 	"dram",
 	"pp1-gpu",
+	"psys",
 };
 
 /* Clients have PP0, PKG */
@@ -89,6 +96,13 @@ static const char *const rapl_domain_names[NR_RAPL_DOMAINS] __initconst = {
 			 1<<RAPL_IDX_RAM_NRG_STAT|\
 			 1<<RAPL_IDX_PP1_NRG_STAT)
 
+/* SKL clients have PP0, PKG, RAM, PP1, PSYS */
+#define RAPL_IDX_SKL_CLN (1<<RAPL_IDX_PP0_NRG_STAT|\
+			  1<<RAPL_IDX_PKG_NRG_STAT|\
+			  1<<RAPL_IDX_RAM_NRG_STAT|\
+			  1<<RAPL_IDX_PP1_NRG_STAT|\
+			  1<<RAPL_IDX_PSYS_NRG_STAT)
+
 /* Knights Landing has PKG, RAM */
 #define RAPL_IDX_KNL	(1<<RAPL_IDX_PKG_NRG_STAT|\
 			 1<<RAPL_IDX_RAM_NRG_STAT)
@@ -360,6 +374,10 @@ static int rapl_pmu_event_init(struct perf_event *event)
 		bit = RAPL_IDX_PP1_NRG_STAT;
 		msr = MSR_PP1_ENERGY_STATUS;
 		break;
+	case INTEL_RAPL_PSYS:
+		bit = RAPL_IDX_PSYS_NRG_STAT;
+		msr = MSR_PLATFORM_ENERGY_STATUS;
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -414,11 +432,13 @@ RAPL_EVENT_ATTR_STR(energy-cores, rapl_cores, "event=0x01");
 RAPL_EVENT_ATTR_STR(energy-pkg  ,   rapl_pkg, "event=0x02");
 RAPL_EVENT_ATTR_STR(energy-ram  ,   rapl_ram, "event=0x03");
 RAPL_EVENT_ATTR_STR(energy-gpu  ,   rapl_gpu, "event=0x04");
+RAPL_EVENT_ATTR_STR(energy-psys,   rapl_psys, "event=0x05");
 
 RAPL_EVENT_ATTR_STR(energy-cores.unit, rapl_cores_unit, "Joules");
 RAPL_EVENT_ATTR_STR(energy-pkg.unit  ,   rapl_pkg_unit, "Joules");
 RAPL_EVENT_ATTR_STR(energy-ram.unit  ,   rapl_ram_unit, "Joules");
 RAPL_EVENT_ATTR_STR(energy-gpu.unit  ,   rapl_gpu_unit, "Joules");
+RAPL_EVENT_ATTR_STR(energy-psys.unit,   rapl_psys_unit, "Joules");
 
 /*
  * we compute in 0.23 nJ increments regardless of MSR
@@ -427,6 +447,7 @@ RAPL_EVENT_ATTR_STR(energy-cores.scale, rapl_cores_scale, "2.3283064365386962890
 RAPL_EVENT_ATTR_STR(energy-pkg.scale,     rapl_pkg_scale, "2.3283064365386962890625e-10");
 RAPL_EVENT_ATTR_STR(energy-ram.scale,     rapl_ram_scale, "2.3283064365386962890625e-10");
 RAPL_EVENT_ATTR_STR(energy-gpu.scale,     rapl_gpu_scale, "2.3283064365386962890625e-10");
+RAPL_EVENT_ATTR_STR(energy-psys.scale,   rapl_psys_scale, "2.3283064365386962890625e-10");
 
 static struct attribute *rapl_events_srv_attr[] = {
 	EVENT_PTR(rapl_cores),
@@ -476,6 +497,27 @@ static struct attribute *rapl_events_hsw_attr[] = {
 	NULL,
 };
 
+static struct attribute *rapl_events_skl_attr[] = {
+	EVENT_PTR(rapl_cores),
+	EVENT_PTR(rapl_pkg),
+	EVENT_PTR(rapl_gpu),
+	EVENT_PTR(rapl_ram),
+	EVENT_PTR(rapl_psys),
+
+	EVENT_PTR(rapl_cores_unit),
+	EVENT_PTR(rapl_pkg_unit),
+	EVENT_PTR(rapl_gpu_unit),
+	EVENT_PTR(rapl_ram_unit),
+	EVENT_PTR(rapl_psys_unit),
+
+	EVENT_PTR(rapl_cores_scale),
+	EVENT_PTR(rapl_pkg_scale),
+	EVENT_PTR(rapl_gpu_scale),
+	EVENT_PTR(rapl_ram_scale),
+	EVENT_PTR(rapl_psys_scale),
+	NULL,
+};
+
 static struct attribute *rapl_events_knl_attr[] = {
 	EVENT_PTR(rapl_pkg),
 	EVENT_PTR(rapl_ram),
@@ -729,6 +771,11 @@ static int __init rapl_pmu_init(void)
 		rapl_cntr_mask = RAPL_IDX_SRV;
 		rapl_pmu_events_group.attrs = rapl_events_srv_attr;
 		break;
+	case 78: /* Skylake client */
+	case 94: /* Skylake H/S */
+		rapl_cntr_mask = RAPL_IDX_SKL_CLN;
+		rapl_pmu_events_group.attrs = rapl_events_skl_attr;
+		break;
 	case 87: /* Knights Landing */
 		apply_quirk = true;
 		rapl_cntr_mask = RAPL_IDX_KNL;
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index 5b3c9a5..0755d1c 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -205,6 +205,8 @@
 #define MSR_CONFIG_TDP_CONTROL		0x0000064B
 #define MSR_TURBO_ACTIVATION_RATIO	0x0000064C
 
+#define MSR_PLATFORM_ENERGY_STATUS	0x0000064D
+
 #define MSR_PKG_WEIGHTED_CORE_C0_RES	0x00000658
 #define MSR_PKG_ANY_CORE_C0_RES		0x00000659
 #define MSR_PKG_ANY_GFXE_C0_RES		0x0000065A
-- 
1.9.1

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

* [PATCH v4 2/2] powercap: intel_rapl: PSys support
  2016-04-17 22:02 [PATCH v4 0/2] Skylake PSys support Srinivas Pandruvada
  2016-04-17 22:03 ` [PATCH v4 1/2] perf/x86/intel/rapl: support Skylake RAPL domains Srinivas Pandruvada
@ 2016-04-17 22:03 ` Srinivas Pandruvada
  2016-04-28 10:26   ` [tip:perf/core] powercap, perf/x86/intel/rapl: Add " tip-bot for Srinivas Pandruvada
  2016-04-20 13:59 ` [PATCH v4 0/2] Skylake " Peter Zijlstra
  2 siblings, 1 reply; 12+ messages in thread
From: Srinivas Pandruvada @ 2016-04-17 22:03 UTC (permalink / raw)
  To: tglx, mingo, hpa, rjw
  Cc: x86, peterz, bp, linux-kernel, jacob.jun.pan, linux-pm,
	Srinivas Pandruvada

Skylake processor supports a new set of RAPL registers for controlling
entire SoC instead of just CPU package. This is useful for thermal
and power control when source of power/thermal is not just CPU/GPU.
This change adds a new platform domain (AKA PSys) to the current
power capping Intel RAPL driver.
PSys also supports PL1 (long term) and PL2 (short term) control like
package domain. This also follows same MSRs for energy and time
units as package domain.
Unlike package domain, PSys support requires more than just processor
level implementation. The other parts in the system need additional
implementation, which OEMs needs to support. So not all Skylake
systems will support PSys.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 drivers/powercap/intel_rapl.c | 69 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
index 8fad0a7..f2201d4 100644
--- a/drivers/powercap/intel_rapl.c
+++ b/drivers/powercap/intel_rapl.c
@@ -34,6 +34,9 @@
 #include <asm/processor.h>
 #include <asm/cpu_device_id.h>
 
+/* Local defines */
+#define MSR_PLATFORM_POWER_LIMIT	0x0000065C
+
 /* bitmasks for RAPL MSRs, used by primitive access functions */
 #define ENERGY_STATUS_MASK      0xffffffff
 
@@ -86,6 +89,7 @@ enum rapl_domain_type {
 	RAPL_DOMAIN_PP0, /* core power plane */
 	RAPL_DOMAIN_PP1, /* graphics uncore */
 	RAPL_DOMAIN_DRAM,/* DRAM control_type */
+	RAPL_DOMAIN_PLATFORM, /* PSys control_type */
 	RAPL_DOMAIN_MAX,
 };
 
@@ -251,9 +255,11 @@ static const char * const rapl_domain_names[] = {
 	"core",
 	"uncore",
 	"dram",
+	"psys",
 };
 
 static struct powercap_control_type *control_type; /* PowerCap Controller */
+static struct rapl_domain *platform_rapl_domain; /* Platform (PSys) domain */
 
 /* caller to ensure CPU hotplug lock is held */
 static struct rapl_package *find_package_by_id(int id)
@@ -409,6 +415,14 @@ static const struct powercap_zone_ops zone_ops[] = {
 		.set_enable = set_domain_enable,
 		.get_enable = get_domain_enable,
 	},
+	/* RAPL_DOMAIN_PLATFORM */
+	{
+		.get_energy_uj = get_energy_counter,
+		.get_max_energy_range_uj = get_max_energy_counter,
+		.release = release_zone,
+		.set_enable = set_domain_enable,
+		.get_enable = get_domain_enable,
+	},
 };
 
 static int set_power_limit(struct powercap_zone *power_zone, int id,
@@ -1160,6 +1174,13 @@ static int rapl_unregister_powercap(void)
 			powercap_unregister_zone(control_type,
 						&rd_package->power_zone);
 	}
+
+	if (platform_rapl_domain) {
+		powercap_unregister_zone(control_type,
+					 &platform_rapl_domain->power_zone);
+		kfree(platform_rapl_domain);
+	}
+
 	powercap_unregister_control_type(control_type);
 
 	return 0;
@@ -1239,6 +1260,47 @@ err_cleanup:
 	return ret;
 }
 
+static int rapl_register_psys(void)
+{
+	struct rapl_domain *rd;
+	struct powercap_zone *power_zone;
+	u64 val;
+
+	if (rdmsrl_safe_on_cpu(0, MSR_PLATFORM_ENERGY_STATUS, &val) || !val)
+		return -ENODEV;
+
+	if (rdmsrl_safe_on_cpu(0, MSR_PLATFORM_POWER_LIMIT, &val) || !val)
+		return -ENODEV;
+
+	rd = kzalloc(sizeof(*rd), GFP_KERNEL);
+	if (!rd)
+		return -ENOMEM;
+
+	rd->name = rapl_domain_names[RAPL_DOMAIN_PLATFORM];
+	rd->id = RAPL_DOMAIN_PLATFORM;
+	rd->msrs[0] = MSR_PLATFORM_POWER_LIMIT;
+	rd->msrs[1] = MSR_PLATFORM_ENERGY_STATUS;
+	rd->rpl[0].prim_id = PL1_ENABLE;
+	rd->rpl[0].name = pl1_name;
+	rd->rpl[1].prim_id = PL2_ENABLE;
+	rd->rpl[1].name = pl2_name;
+	rd->rp = find_package_by_id(0);
+
+	power_zone = powercap_register_zone(&rd->power_zone, control_type,
+					    "psys", NULL,
+					    &zone_ops[RAPL_DOMAIN_PLATFORM],
+					    2, &constraint_ops);
+
+	if (IS_ERR(power_zone)) {
+		kfree(rd);
+		return PTR_ERR(power_zone);
+	}
+
+	platform_rapl_domain = rd;
+
+	return 0;
+}
+
 static int rapl_register_powercap(void)
 {
 	struct rapl_domain *rd;
@@ -1255,6 +1317,10 @@ static int rapl_register_powercap(void)
 	list_for_each_entry(rp, &rapl_packages, plist)
 		if (rapl_package_register_powercap(rp))
 			goto err_cleanup_package;
+
+	/* Don't bail out if PSys is not supported */
+	rapl_register_psys();
+
 	return ret;
 
 err_cleanup_package:
@@ -1289,6 +1355,9 @@ static int rapl_check_domain(int cpu, int domain)
 	case RAPL_DOMAIN_DRAM:
 		msr = MSR_DRAM_ENERGY_STATUS;
 		break;
+	case RAPL_DOMAIN_PLATFORM:
+		/* PSYS(PLATFORM) is not a CPU domain, so avoid printng error */
+		return -EINVAL;
 	default:
 		pr_err("invalid domain id %d\n", domain);
 		return -EINVAL;
-- 
1.9.1

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

* Re: [PATCH v4 0/2] Skylake PSys support
  2016-04-17 22:02 [PATCH v4 0/2] Skylake PSys support Srinivas Pandruvada
  2016-04-17 22:03 ` [PATCH v4 1/2] perf/x86/intel/rapl: support Skylake RAPL domains Srinivas Pandruvada
  2016-04-17 22:03 ` [PATCH v4 2/2] powercap: intel_rapl: PSys support Srinivas Pandruvada
@ 2016-04-20 13:59 ` Peter Zijlstra
  2016-04-20 18:28   ` Srinivas Pandruvada
  2 siblings, 1 reply; 12+ messages in thread
From: Peter Zijlstra @ 2016-04-20 13:59 UTC (permalink / raw)
  To: Srinivas Pandruvada
  Cc: tglx, mingo, hpa, rjw, x86, bp, linux-kernel, jacob.jun.pan, linux-pm

On Sun, Apr 17, 2016 at 03:02:59PM -0700, Srinivas Pandruvada wrote:
> Skylake processor supports a new set of RAPL registers for controlling
> entire SoC instead of just CPU package called PSys. This change adds
> support in two sub systems:
> 
> x86/perf: Adds basic support for Skylake RAPL and PSys support
> 
> powercap/rapl: A new platform domain to the current power capping Intel
> RAPL driver.

> Srinivas Pandruvada (2):
>   perf/x86/intel/rapl: support Skylake RAPL domains
>   powercap: intel_rapl: PSys support
> 
>  arch/x86/events/intel/rapl.c     | 51 +++++++++++++++++++++++++++--
>  arch/x86/include/asm/msr-index.h |  2 ++
>  drivers/powercap/intel_rapl.c    | 69 ++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 120 insertions(+), 2 deletions(-)

These two patches depend on one another, right? Because the first patch
adds the MSR the second patch uses?

How should we go about merging this? The perf-rapl stuff normally goes
through tip while the powercap stuff goes through Rafael's tree.

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

* Re: [PATCH v4 1/2] perf/x86/intel/rapl: support Skylake RAPL domains
  2016-04-17 22:03 ` [PATCH v4 1/2] perf/x86/intel/rapl: support Skylake RAPL domains Srinivas Pandruvada
@ 2016-04-20 15:43   ` Peter Zijlstra
  2016-04-20 15:54     ` Srinivas Pandruvada
  2016-04-23 12:55   ` [tip:perf/core] perf/x86/intel/rapl: Support " tip-bot for Srinivas Pandruvada
  1 sibling, 1 reply; 12+ messages in thread
From: Peter Zijlstra @ 2016-04-20 15:43 UTC (permalink / raw)
  To: Srinivas Pandruvada
  Cc: tglx, mingo, hpa, rjw, x86, bp, linux-kernel, jacob.jun.pan, linux-pm

On Sun, Apr 17, 2016 at 03:03:00PM -0700, Srinivas Pandruvada wrote:
> @@ -729,6 +771,11 @@ static int __init rapl_pmu_init(void)
>  		rapl_cntr_mask = RAPL_IDX_SRV;
>  		rapl_pmu_events_group.attrs = rapl_events_srv_attr;
>  		break;
> +	case 78: /* Skylake client */
> +	case 94: /* Skylake H/S */
> +		rapl_cntr_mask = RAPL_IDX_SKL_CLN;
> +		rapl_pmu_events_group.attrs = rapl_events_skl_attr;
> +		break;
>  	case 87: /* Knights Landing */
>  		apply_quirk = true;
>  		rapl_cntr_mask = RAPL_IDX_KNL;

Please post this against tip/perf/core, all this code got munged in
patch:

  4b6e2571bf00 ("x86/perf/intel/rapl: Make the Intel RAPL PMU driver modular")

Also; what about 85 (skl-server)?

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

* Re: [PATCH v4 1/2] perf/x86/intel/rapl: support Skylake RAPL domains
  2016-04-20 15:43   ` Peter Zijlstra
@ 2016-04-20 15:54     ` Srinivas Pandruvada
  0 siblings, 0 replies; 12+ messages in thread
From: Srinivas Pandruvada @ 2016-04-20 15:54 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: tglx, mingo, hpa, rjw, x86, bp, linux-kernel, jacob.jun.pan, linux-pm

On Wed, 2016-04-20 at 17:43 +0200, Peter Zijlstra wrote:
> On Sun, Apr 17, 2016 at 03:03:00PM -0700, Srinivas Pandruvada wrote:
> > 
> > @@ -729,6 +771,11 @@ static int __init rapl_pmu_init(void)
> >  		rapl_cntr_mask = RAPL_IDX_SRV;
> >  		rapl_pmu_events_group.attrs =
> > rapl_events_srv_attr;
> >  		break;
> > +	case 78: /* Skylake client */
> > +	case 94: /* Skylake H/S */
> > +		rapl_cntr_mask = RAPL_IDX_SKL_CLN;
> > +		rapl_pmu_events_group.attrs =
> > rapl_events_skl_attr;
> > +		break;
> >  	case 87: /* Knights Landing */
> >  		apply_quirk = true;
> >  		rapl_cntr_mask = RAPL_IDX_KNL;
> Please post this against tip/perf/core, all this code got munged in
> patch:
> 
>   4b6e2571bf00 ("x86/perf/intel/rapl: Make the Intel RAPL PMU driver
> modular")
I will repost.

> 
> Also; what about 85 (skl-server)?
I didn't get chance to test RAPL on SKL server. It should follow BDW
server, but want to test before.

Thanks,
Srinivas

> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v4 0/2] Skylake PSys support
  2016-04-20 13:59 ` [PATCH v4 0/2] Skylake " Peter Zijlstra
@ 2016-04-20 18:28   ` Srinivas Pandruvada
  2016-04-20 20:21     ` Rafael J. Wysocki
  0 siblings, 1 reply; 12+ messages in thread
From: Srinivas Pandruvada @ 2016-04-20 18:28 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: tglx, mingo, hpa, rjw, x86, bp, linux-kernel, jacob.jun.pan, linux-pm

On Wed, 2016-04-20 at 15:59 +0200, Peter Zijlstra wrote:
> On Sun, Apr 17, 2016 at 03:02:59PM -0700, Srinivas Pandruvada wrote:
> > 
> > Skylake processor supports a new set of RAPL registers for
> > controlling
> > entire SoC instead of just CPU package called PSys. This change
> > adds
> > support in two sub systems:
> > 
> > x86/perf: Adds basic support for Skylake RAPL and PSys support
> > 
> > powercap/rapl: A new platform domain to the current power capping
> > Intel
> > RAPL driver.
> > 
> > Srinivas Pandruvada (2):
> >   perf/x86/intel/rapl: support Skylake RAPL domains
> >   powercap: intel_rapl: PSys support
> > 
> >  arch/x86/events/intel/rapl.c     | 51 +++++++++++++++++++++++++++-
> > -
> >  arch/x86/include/asm/msr-index.h |  2 ++
> >  drivers/powercap/intel_rapl.c    | 69
> > ++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 120 insertions(+), 2 deletions(-)
> These two patches depend on one another, right? 
Yes.
> Because the first patch
> adds the MSR the second patch uses?
> 
> How should we go about merging this? The perf-rapl stuff normally
> goes
> through tip while the powercap stuff goes through Rafael's tree.
Do you want me to only send PERF patch and wait for this to be merged
before sending powercap?

Thanks,
Srinivas

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

* Re: [PATCH v4 0/2] Skylake PSys support
  2016-04-20 18:28   ` Srinivas Pandruvada
@ 2016-04-20 20:21     ` Rafael J. Wysocki
  2016-04-21 13:10       ` Peter Zijlstra
  0 siblings, 1 reply; 12+ messages in thread
From: Rafael J. Wysocki @ 2016-04-20 20:21 UTC (permalink / raw)
  To: Srinivas Pandruvada
  Cc: Peter Zijlstra, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Rafael J. Wysocki, the arch/x86 maintainers, Borislav Petkov,
	Linux Kernel Mailing List, Jacob Pan, linux-pm

On Wed, Apr 20, 2016 at 8:28 PM, Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
> On Wed, 2016-04-20 at 15:59 +0200, Peter Zijlstra wrote:
>> On Sun, Apr 17, 2016 at 03:02:59PM -0700, Srinivas Pandruvada wrote:
>> >
>> > Skylake processor supports a new set of RAPL registers for
>> > controlling
>> > entire SoC instead of just CPU package called PSys. This change
>> > adds
>> > support in two sub systems:
>> >
>> > x86/perf: Adds basic support for Skylake RAPL and PSys support
>> >
>> > powercap/rapl: A new platform domain to the current power capping
>> > Intel
>> > RAPL driver.
>> >
>> > Srinivas Pandruvada (2):
>> >   perf/x86/intel/rapl: support Skylake RAPL domains
>> >   powercap: intel_rapl: PSys support
>> >
>> >  arch/x86/events/intel/rapl.c     | 51 +++++++++++++++++++++++++++-
>> > -
>> >  arch/x86/include/asm/msr-index.h |  2 ++
>> >  drivers/powercap/intel_rapl.c    | 69
>> > ++++++++++++++++++++++++++++++++++++++++
>> >  3 files changed, 120 insertions(+), 2 deletions(-)
>> These two patches depend on one another, right?
> Yes.
>> Because the first patch
>> adds the MSR the second patch uses?
>>
>> How should we go about merging this? The perf-rapl stuff normally
>> goes
>> through tip while the powercap stuff goes through Rafael's tree.
> Do you want me to only send PERF patch and wait for this to be merged
> before sending powercap?

You can send both and they both can go in via tip as far as I'm concerned.

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

* Re: [PATCH v4 0/2] Skylake PSys support
  2016-04-20 20:21     ` Rafael J. Wysocki
@ 2016-04-21 13:10       ` Peter Zijlstra
  2016-04-21 14:48         ` Srinivas Pandruvada
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Zijlstra @ 2016-04-21 13:10 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Srinivas Pandruvada, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, Rafael J. Wysocki, the arch/x86 maintainers,
	Borislav Petkov, Linux Kernel Mailing List, Jacob Pan, linux-pm

On Wed, Apr 20, 2016 at 10:21:14PM +0200, Rafael J. Wysocki wrote:
> You can send both and they both can go in via tip as far as I'm concerned.

OK, thanks!

Srinivas I've munged the rapl patch to match the new style, so no need
to resend that.

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

* Re: [PATCH v4 0/2] Skylake PSys support
  2016-04-21 13:10       ` Peter Zijlstra
@ 2016-04-21 14:48         ` Srinivas Pandruvada
  0 siblings, 0 replies; 12+ messages in thread
From: Srinivas Pandruvada @ 2016-04-21 14:48 UTC (permalink / raw)
  To: Peter Zijlstra, Rafael J. Wysocki
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Rafael J. Wysocki,
	the arch/x86 maintainers, Borislav Petkov,
	Linux Kernel Mailing List, Jacob Pan, linux-pm

On Thu, 2016-04-21 at 15:10 +0200, Peter Zijlstra wrote:
> On Wed, Apr 20, 2016 at 10:21:14PM +0200, Rafael J. Wysocki wrote:
> > You can send both and they both can go in via tip as far as I'm
> > concerned.
> 
> OK, thanks!
> 
> Srinivas I've munged the rapl patch to match the new style, so no
> need
> to resend that.
Thanks Peter.

-Srinivas

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

* [tip:perf/core] perf/x86/intel/rapl: Support Skylake RAPL domains
  2016-04-17 22:03 ` [PATCH v4 1/2] perf/x86/intel/rapl: support Skylake RAPL domains Srinivas Pandruvada
  2016-04-20 15:43   ` Peter Zijlstra
@ 2016-04-23 12:55   ` tip-bot for Srinivas Pandruvada
  1 sibling, 0 replies; 12+ messages in thread
From: tip-bot for Srinivas Pandruvada @ 2016-04-23 12:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, eranian, vincent.weaver, srinivas.pandruvada, jolsa, tglx,
	hpa, mingo, alexander.shishkin, peterz, linux-kernel, torvalds

Commit-ID:  dcee75b3b7f025cc6765e6c92ba0a4e59a4d25f4
Gitweb:     http://git.kernel.org/tip/dcee75b3b7f025cc6765e6c92ba0a4e59a4d25f4
Author:     Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
AuthorDate: Sun, 17 Apr 2016 15:03:00 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 23 Apr 2016 14:13:36 +0200

perf/x86/intel/rapl: Support Skylake RAPL domains

Add Skylake client support for RAPL domains. In addition to RAPL domains
in Broadwell clients, it has support for platform domain (aka PSys). The
PSys domain controls the entire SoC instead of just a CPU package. Unlike
package domain, PSys support requires more than just processor level
implementation. The other parts in the system need additional HW level
signaling, which OEMs need to support. When not supported, the energy
counter register in PSys domain returns 0.

Also corrected error in comment for GPU counter, which previously was
DRAM counter.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com
[ Cnverted to model_match stuff. ]
Signed-off-by: Peter Zijlstra (Intel) <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: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: bp@alien8.de
Cc: hpa@zytor.com
Cc: jacob.jun.pan@linux.intel.com
Cc: rjw@rjwysocki.net
Link: http://lkml.kernel.org/r/1460930581-29748-2-git-send-email-srinivas.pandruvada@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/events/intel/rapl.c     | 54 ++++++++++++++++++++++++++++++++++++++--
 arch/x86/include/asm/msr-index.h |  2 ++
 2 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index c9b7489..26c7d7d 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -27,10 +27,14 @@
  *	  event: rapl_energy_dram
  *    perf code: 0x3
  *
- * dram counter: consumption of the builtin-gpu domain (client only)
+ * gpu counter: consumption of the builtin-gpu domain (client only)
  *	  event: rapl_energy_gpu
  *    perf code: 0x4
  *
+ *  psys counter: consumption of the builtin-psys domain (client only)
+ *	  event: rapl_energy_psys
+ *    perf code: 0x5
+ *
  * We manage those counters as free running (read-only). They may be
  * use simultaneously by other tools, such as turbostat.
  *
@@ -66,13 +70,16 @@ MODULE_LICENSE("GPL");
 #define INTEL_RAPL_RAM		0x3	/* pseudo-encoding */
 #define RAPL_IDX_PP1_NRG_STAT	3	/* gpu */
 #define INTEL_RAPL_PP1		0x4	/* pseudo-encoding */
+#define RAPL_IDX_PSYS_NRG_STAT	4	/* psys */
+#define INTEL_RAPL_PSYS		0x5	/* pseudo-encoding */
 
-#define NR_RAPL_DOMAINS         0x4
+#define NR_RAPL_DOMAINS         0x5
 static const char *const rapl_domain_names[NR_RAPL_DOMAINS] __initconst = {
 	"pp0-core",
 	"package",
 	"dram",
 	"pp1-gpu",
+	"psys",
 };
 
 /* Clients have PP0, PKG */
@@ -91,6 +98,13 @@ static const char *const rapl_domain_names[NR_RAPL_DOMAINS] __initconst = {
 			 1<<RAPL_IDX_RAM_NRG_STAT|\
 			 1<<RAPL_IDX_PP1_NRG_STAT)
 
+/* SKL clients have PP0, PKG, RAM, PP1, PSYS */
+#define RAPL_IDX_SKL_CLN (1<<RAPL_IDX_PP0_NRG_STAT|\
+			  1<<RAPL_IDX_PKG_NRG_STAT|\
+			  1<<RAPL_IDX_RAM_NRG_STAT|\
+			  1<<RAPL_IDX_PP1_NRG_STAT|\
+			  1<<RAPL_IDX_PSYS_NRG_STAT)
+
 /* Knights Landing has PKG, RAM */
 #define RAPL_IDX_KNL	(1<<RAPL_IDX_PKG_NRG_STAT|\
 			 1<<RAPL_IDX_RAM_NRG_STAT)
@@ -362,6 +376,10 @@ static int rapl_pmu_event_init(struct perf_event *event)
 		bit = RAPL_IDX_PP1_NRG_STAT;
 		msr = MSR_PP1_ENERGY_STATUS;
 		break;
+	case INTEL_RAPL_PSYS:
+		bit = RAPL_IDX_PSYS_NRG_STAT;
+		msr = MSR_PLATFORM_ENERGY_STATUS;
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -416,11 +434,13 @@ RAPL_EVENT_ATTR_STR(energy-cores, rapl_cores, "event=0x01");
 RAPL_EVENT_ATTR_STR(energy-pkg  ,   rapl_pkg, "event=0x02");
 RAPL_EVENT_ATTR_STR(energy-ram  ,   rapl_ram, "event=0x03");
 RAPL_EVENT_ATTR_STR(energy-gpu  ,   rapl_gpu, "event=0x04");
+RAPL_EVENT_ATTR_STR(energy-psys,   rapl_psys, "event=0x05");
 
 RAPL_EVENT_ATTR_STR(energy-cores.unit, rapl_cores_unit, "Joules");
 RAPL_EVENT_ATTR_STR(energy-pkg.unit  ,   rapl_pkg_unit, "Joules");
 RAPL_EVENT_ATTR_STR(energy-ram.unit  ,   rapl_ram_unit, "Joules");
 RAPL_EVENT_ATTR_STR(energy-gpu.unit  ,   rapl_gpu_unit, "Joules");
+RAPL_EVENT_ATTR_STR(energy-psys.unit,   rapl_psys_unit, "Joules");
 
 /*
  * we compute in 0.23 nJ increments regardless of MSR
@@ -429,6 +449,7 @@ RAPL_EVENT_ATTR_STR(energy-cores.scale, rapl_cores_scale, "2.3283064365386962890
 RAPL_EVENT_ATTR_STR(energy-pkg.scale,     rapl_pkg_scale, "2.3283064365386962890625e-10");
 RAPL_EVENT_ATTR_STR(energy-ram.scale,     rapl_ram_scale, "2.3283064365386962890625e-10");
 RAPL_EVENT_ATTR_STR(energy-gpu.scale,     rapl_gpu_scale, "2.3283064365386962890625e-10");
+RAPL_EVENT_ATTR_STR(energy-psys.scale,   rapl_psys_scale, "2.3283064365386962890625e-10");
 
 static struct attribute *rapl_events_srv_attr[] = {
 	EVENT_PTR(rapl_cores),
@@ -478,6 +499,27 @@ static struct attribute *rapl_events_hsw_attr[] = {
 	NULL,
 };
 
+static struct attribute *rapl_events_skl_attr[] = {
+	EVENT_PTR(rapl_cores),
+	EVENT_PTR(rapl_pkg),
+	EVENT_PTR(rapl_gpu),
+	EVENT_PTR(rapl_ram),
+	EVENT_PTR(rapl_psys),
+
+	EVENT_PTR(rapl_cores_unit),
+	EVENT_PTR(rapl_pkg_unit),
+	EVENT_PTR(rapl_gpu_unit),
+	EVENT_PTR(rapl_ram_unit),
+	EVENT_PTR(rapl_psys_unit),
+
+	EVENT_PTR(rapl_cores_scale),
+	EVENT_PTR(rapl_pkg_scale),
+	EVENT_PTR(rapl_gpu_scale),
+	EVENT_PTR(rapl_ram_scale),
+	EVENT_PTR(rapl_psys_scale),
+	NULL,
+};
+
 static struct attribute *rapl_events_knl_attr[] = {
 	EVENT_PTR(rapl_pkg),
 	EVENT_PTR(rapl_ram),
@@ -737,6 +779,12 @@ static const struct intel_rapl_init_fun knl_rapl_init __initconst = {
 	.attrs = rapl_events_knl_attr,
 };
 
+static const struct intel_rapl_init_fun skl_rapl_init __initconst = {
+	.apply_quirk = false,
+	.cntr_mask = RAPL_IDX_SKL_CLN,
+	.attrs = rapl_events_skl_attr,
+};
+
 static const struct x86_cpu_id rapl_cpu_match[] __initconst = {
 	X86_RAPL_MODEL_MATCH(42, snb_rapl_init),	/* Sandy Bridge */
 	X86_RAPL_MODEL_MATCH(58, snb_rapl_init),	/* Ivy Bridge */
@@ -750,6 +798,8 @@ static const struct x86_cpu_id rapl_cpu_match[] __initconst = {
 	X86_RAPL_MODEL_MATCH(45, snbep_rapl_init),	/* Sandy Bridge-EP */
 	X86_RAPL_MODEL_MATCH(62, snbep_rapl_init),	/* IvyTown */
 	X86_RAPL_MODEL_MATCH(87, knl_rapl_init),	/* Knights Landing */
+	X86_RAPL_MODEL_MATCH(78, skl_rapl_init),	/* Skylake */
+	X86_RAPL_MODEL_MATCH(94, skl_rapl_init),	/* Skylake H/S */
 	{},
 };
 
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index f882cbf..94555b4 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -205,6 +205,8 @@
 #define MSR_CONFIG_TDP_CONTROL		0x0000064B
 #define MSR_TURBO_ACTIVATION_RATIO	0x0000064C
 
+#define MSR_PLATFORM_ENERGY_STATUS	0x0000064D
+
 #define MSR_PKG_WEIGHTED_CORE_C0_RES	0x00000658
 #define MSR_PKG_ANY_CORE_C0_RES		0x00000659
 #define MSR_PKG_ANY_GFXE_C0_RES		0x0000065A

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

* [tip:perf/core] powercap, perf/x86/intel/rapl: Add PSys support
  2016-04-17 22:03 ` [PATCH v4 2/2] powercap: intel_rapl: PSys support Srinivas Pandruvada
@ 2016-04-28 10:26   ` tip-bot for Srinivas Pandruvada
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Srinivas Pandruvada @ 2016-04-28 10:26 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, acme, tglx, alexander.shishkin, linux-kernel,
	srinivas.pandruvada, jolsa, rafael.j.wysocki, eranian, hpa,
	vincent.weaver, peterz

Commit-ID:  3521ba1cc351e80488c3f85748c92c3853b75818
Gitweb:     http://git.kernel.org/tip/3521ba1cc351e80488c3f85748c92c3853b75818
Author:     Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
AuthorDate: Sun, 17 Apr 2016 15:03:01 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 28 Apr 2016 10:39:19 +0200

powercap, perf/x86/intel/rapl: Add PSys support

Skylake processor supports a new set of RAPL registers for controlling
entire SoC instead of just CPU package. This is useful for thermal
and power control when source of power/thermal is not just CPU/GPU.
This change adds a new platform domain (AKA PSys) to the current
power capping Intel RAPL driver.

PSys also supports PL1 (long term) and PL2 (short term) control like
package domain. This also follows same MSRs for energy and time
units as package domain.

Unlike package domain, PSys support requires more than just processor
level implementation. The other parts in the system need additional
implementation, which OEMs needs to support. So not all Skylake
systems will support PSys.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: bp@alien8.de
Cc: hpa@zytor.com
Cc: jacob.jun.pan@linux.intel.com
Cc: rjw@rjwysocki.net
Link: http://lkml.kernel.org/r/1460930581-29748-3-git-send-email-srinivas.pandruvada@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 drivers/powercap/intel_rapl.c | 69 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
index 8fad0a7..f2201d4 100644
--- a/drivers/powercap/intel_rapl.c
+++ b/drivers/powercap/intel_rapl.c
@@ -34,6 +34,9 @@
 #include <asm/processor.h>
 #include <asm/cpu_device_id.h>
 
+/* Local defines */
+#define MSR_PLATFORM_POWER_LIMIT	0x0000065C
+
 /* bitmasks for RAPL MSRs, used by primitive access functions */
 #define ENERGY_STATUS_MASK      0xffffffff
 
@@ -86,6 +89,7 @@ enum rapl_domain_type {
 	RAPL_DOMAIN_PP0, /* core power plane */
 	RAPL_DOMAIN_PP1, /* graphics uncore */
 	RAPL_DOMAIN_DRAM,/* DRAM control_type */
+	RAPL_DOMAIN_PLATFORM, /* PSys control_type */
 	RAPL_DOMAIN_MAX,
 };
 
@@ -251,9 +255,11 @@ static const char * const rapl_domain_names[] = {
 	"core",
 	"uncore",
 	"dram",
+	"psys",
 };
 
 static struct powercap_control_type *control_type; /* PowerCap Controller */
+static struct rapl_domain *platform_rapl_domain; /* Platform (PSys) domain */
 
 /* caller to ensure CPU hotplug lock is held */
 static struct rapl_package *find_package_by_id(int id)
@@ -409,6 +415,14 @@ static const struct powercap_zone_ops zone_ops[] = {
 		.set_enable = set_domain_enable,
 		.get_enable = get_domain_enable,
 	},
+	/* RAPL_DOMAIN_PLATFORM */
+	{
+		.get_energy_uj = get_energy_counter,
+		.get_max_energy_range_uj = get_max_energy_counter,
+		.release = release_zone,
+		.set_enable = set_domain_enable,
+		.get_enable = get_domain_enable,
+	},
 };
 
 static int set_power_limit(struct powercap_zone *power_zone, int id,
@@ -1160,6 +1174,13 @@ static int rapl_unregister_powercap(void)
 			powercap_unregister_zone(control_type,
 						&rd_package->power_zone);
 	}
+
+	if (platform_rapl_domain) {
+		powercap_unregister_zone(control_type,
+					 &platform_rapl_domain->power_zone);
+		kfree(platform_rapl_domain);
+	}
+
 	powercap_unregister_control_type(control_type);
 
 	return 0;
@@ -1239,6 +1260,47 @@ err_cleanup:
 	return ret;
 }
 
+static int rapl_register_psys(void)
+{
+	struct rapl_domain *rd;
+	struct powercap_zone *power_zone;
+	u64 val;
+
+	if (rdmsrl_safe_on_cpu(0, MSR_PLATFORM_ENERGY_STATUS, &val) || !val)
+		return -ENODEV;
+
+	if (rdmsrl_safe_on_cpu(0, MSR_PLATFORM_POWER_LIMIT, &val) || !val)
+		return -ENODEV;
+
+	rd = kzalloc(sizeof(*rd), GFP_KERNEL);
+	if (!rd)
+		return -ENOMEM;
+
+	rd->name = rapl_domain_names[RAPL_DOMAIN_PLATFORM];
+	rd->id = RAPL_DOMAIN_PLATFORM;
+	rd->msrs[0] = MSR_PLATFORM_POWER_LIMIT;
+	rd->msrs[1] = MSR_PLATFORM_ENERGY_STATUS;
+	rd->rpl[0].prim_id = PL1_ENABLE;
+	rd->rpl[0].name = pl1_name;
+	rd->rpl[1].prim_id = PL2_ENABLE;
+	rd->rpl[1].name = pl2_name;
+	rd->rp = find_package_by_id(0);
+
+	power_zone = powercap_register_zone(&rd->power_zone, control_type,
+					    "psys", NULL,
+					    &zone_ops[RAPL_DOMAIN_PLATFORM],
+					    2, &constraint_ops);
+
+	if (IS_ERR(power_zone)) {
+		kfree(rd);
+		return PTR_ERR(power_zone);
+	}
+
+	platform_rapl_domain = rd;
+
+	return 0;
+}
+
 static int rapl_register_powercap(void)
 {
 	struct rapl_domain *rd;
@@ -1255,6 +1317,10 @@ static int rapl_register_powercap(void)
 	list_for_each_entry(rp, &rapl_packages, plist)
 		if (rapl_package_register_powercap(rp))
 			goto err_cleanup_package;
+
+	/* Don't bail out if PSys is not supported */
+	rapl_register_psys();
+
 	return ret;
 
 err_cleanup_package:
@@ -1289,6 +1355,9 @@ static int rapl_check_domain(int cpu, int domain)
 	case RAPL_DOMAIN_DRAM:
 		msr = MSR_DRAM_ENERGY_STATUS;
 		break;
+	case RAPL_DOMAIN_PLATFORM:
+		/* PSYS(PLATFORM) is not a CPU domain, so avoid printng error */
+		return -EINVAL;
 	default:
 		pr_err("invalid domain id %d\n", domain);
 		return -EINVAL;

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

end of thread, other threads:[~2016-04-28 10:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-17 22:02 [PATCH v4 0/2] Skylake PSys support Srinivas Pandruvada
2016-04-17 22:03 ` [PATCH v4 1/2] perf/x86/intel/rapl: support Skylake RAPL domains Srinivas Pandruvada
2016-04-20 15:43   ` Peter Zijlstra
2016-04-20 15:54     ` Srinivas Pandruvada
2016-04-23 12:55   ` [tip:perf/core] perf/x86/intel/rapl: Support " tip-bot for Srinivas Pandruvada
2016-04-17 22:03 ` [PATCH v4 2/2] powercap: intel_rapl: PSys support Srinivas Pandruvada
2016-04-28 10:26   ` [tip:perf/core] powercap, perf/x86/intel/rapl: Add " tip-bot for Srinivas Pandruvada
2016-04-20 13:59 ` [PATCH v4 0/2] Skylake " Peter Zijlstra
2016-04-20 18:28   ` Srinivas Pandruvada
2016-04-20 20:21     ` Rafael J. Wysocki
2016-04-21 13:10       ` Peter Zijlstra
2016-04-21 14:48         ` Srinivas Pandruvada

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.