linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kan.liang@linux.intel.com
To: peterz@infradead.org, tglx@linutronix.de, acme@kernel.org,
	mingo@redhat.com, x86@kernel.org, linux-kernel@vger.kernel.org
Cc: len.brown@intel.com, jolsa@redhat.com, namhyung@kernel.org,
	eranian@google.com, ak@linux.intel.com,
	Kan Liang <kan.liang@linux.intel.com>
Subject: [PATCH 08/10] perf/x86/intel/rapl: Support die scope counters on CLX-AP
Date: Tue, 19 Feb 2019 12:00:09 -0800	[thread overview]
Message-ID: <1550606411-5313-9-git-send-email-kan.liang@linux.intel.com> (raw)
In-Reply-To: <1550606411-5313-1-git-send-email-kan.liang@linux.intel.com>

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


  parent reply	other threads:[~2019-02-19 20:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19 20:00 [PATCH 00/10] perf: Multi-die/package support kan.liang
2019-02-19 20:00 ` [PATCH 01/10] perf/x86/intel: Introduce a concept "domain" as the scope of counters kan.liang
2019-02-20 11:12   ` Peter Zijlstra
2019-02-20 14:36     ` Liang, Kan
2019-03-05 20:32       ` Liang, Kan
2019-02-19 20:00 ` [PATCH 02/10] perf/x86/intel/cstate: Apply "domain" for cstate kan.liang
2019-02-19 20:00 ` [PATCH 03/10] perf/x86/intel/uncore: Apply "domain" for uncore kan.liang
2019-02-19 20:00 ` [PATCH 04/10] perf/x86/intel/rapl: Apply "domain" for RAPL kan.liang
2019-02-19 20:00 ` [PATCH 05/10] perf/x86/intel/domain: Add new domain type for die kan.liang
2019-02-19 20:00 ` [PATCH 06/10] perf/x86/intel/cstate: Support die scope counters on CLX-AP kan.liang
2019-02-19 20:00 ` [PATCH 07/10] perf/x86/intel/uncore: " kan.liang
2019-02-19 20:00 ` kan.liang [this message]
2019-02-19 20:00 ` [PATCH 09/10] perf header: Add die information in cpu topology kan.liang
2019-02-19 20:00 ` [PATCH 10/10] perf stat: Support per-die aggregation kan.liang
2019-02-20 10:15 ` [PATCH 00/10] perf: Multi-die/package support Peter Zijlstra
2019-02-20 12:46 ` Jiri Olsa
2019-02-20 13:24   ` Peter Zijlstra
2019-02-20 13:32     ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1550606411-5313-9-git-send-email-kan.liang@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).