lkml.org 
[lkml]   [2019]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 08/10] perf/x86/intel/rapl: Support die scope counters on CLX-AP
Date
From: Kan Liang <kan.liang@linux.intel.com>

CLX-AP has the same RAPL counters as SKX, but they are die scope.

Add clx_ap_rapl_init for CLX-AP.
Add new attr_groups for DIE_DOMAIN.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
---
arch/x86/events/intel/rapl.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index c1ba09c..110b491 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -589,6 +589,18 @@ static const struct attribute_group *rapl_pkg_attr_groups[] = {
NULL,
};

+static struct attribute_group rapl_die_pmu_events_group = {
+ .name = "events",
+ .attrs = NULL, /* patched at runtime */
+};
+
+static const struct attribute_group *rapl_die_attr_groups[] = {
+ &rapl_pmu_attr_group,
+ &rapl_pmu_format_group,
+ &rapl_die_pmu_events_group,
+ NULL,
+};
+
static int __rapl_cpu_offline(unsigned int cpu, struct rapl_pmus *pmus)
{
struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu, pmus);
@@ -791,6 +803,9 @@ static int __init init_rapl_pmus(const struct intel_rapl_events *events,
if (type == PACKAGE_DOMAIN) {
rapl_pkg_pmu_events_group.attrs = events->attrs;
pmus->pmu.attr_groups = rapl_pkg_attr_groups;
+ } else if (type == DIE_DOMAIN) {
+ rapl_die_pmu_events_group.attrs = events->attrs;
+ pmus->pmu.attr_groups = rapl_die_attr_groups;
}
pmus->pmu.task_ctx_nr = perf_invalid_context;
pmus->pmu.event_init = rapl_pmu_event_init;
@@ -860,6 +875,12 @@ static const struct intel_rapl_init_fun hsx_rapl_init __initconst = {
.events[PACKAGE_DOMAIN].attrs = rapl_events_srv_attr,
};

+static const struct intel_rapl_init_fun clx_ap_rapl_init __initconst = {
+ .apply_quirk = true,
+ .events[DIE_DOMAIN].cntr_mask = RAPL_IDX_SRV,
+ .events[DIE_DOMAIN].attrs = rapl_events_srv_attr,
+};
+
static const struct intel_rapl_init_fun hsw_rapl_init __initconst = {
.apply_quirk = false,
.events[PACKAGE_DOMAIN].cntr_mask = RAPL_IDX_HSW,
@@ -933,7 +954,11 @@ static int __init rapl_pmu_init(void)
if (!id)
return -ENODEV;

- rapl_init = (struct intel_rapl_init_fun *)id->driver_data;
+ if ((boot_cpu_data.x86_model == INTEL_FAM6_SKYLAKE_X) &&
+ (boot_cpu_data.x86_max_dies > 1))
+ rapl_init = (struct intel_rapl_init_fun *)&clx_ap_rapl_init;
+ else
+ rapl_init = (struct intel_rapl_init_fun *)id->driver_data;
apply_quirk = rapl_init->apply_quirk;

ret = rapl_check_hw_unit(apply_quirk);
--
2.7.4
\
 
 \ /
  Last update: 2019-02-19 21:02    [W:0.110 / U:46.260 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site