lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1550606411-5313-9-git-send-email-kan.liang@linux.intel.com>
Date:   Tue, 19 Feb 2019 12:00:09 -0800
From:   kan.liang@...ux.intel.com
To:     peterz@...radead.org, tglx@...utronix.de, acme@...nel.org,
        mingo@...hat.com, x86@...nel.org, linux-kernel@...r.kernel.org
Cc:     len.brown@...el.com, jolsa@...hat.com, namhyung@...nel.org,
        eranian@...gle.com, ak@...ux.intel.com,
        Kan Liang <kan.liang@...ux.intel.com>
Subject: [PATCH 08/10] perf/x86/intel/rapl: Support die scope counters on CLX-AP

From: Kan Liang <kan.liang@...ux.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@...ux.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ