mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: <peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>,
	<mark.rutland@arm.com>, <alexander.shishkin@linux.intel.com>,
	<jolsa@redhat.com>, <namhyung@kernel.org>, <will@kernel.org>,
	<ak@linux.intel.com>
Cc: <linuxarm@huawei.com>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <suzuki.poulose@arm.com>,
	<james.clark@arm.com>, <zhangshaokun@hisilicon.com>,
	<robin.murphy@arm.com>, John Garry <john.garry@huawei.com>
Subject: [PATCH RFC 4/7] perf pmu: Rename uncore symbols to include system PMUs
Date: Fri, 24 Jan 2020 22:35:02 +0800	[thread overview]
Message-ID: <1579876505-113251-5-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1579876505-113251-1-git-send-email-john.garry@huawei.com>

We want to expand the perf PMU support to cover system PMUs, which are
essentially the same as uncore pmus (from a kernel sysfs perspective
anyway).

So rename pmu_is_uncore() et al to cover this.

Unfortunately we have no real way to detect if a PMU is uncore or system.
We could check the PMU name for "uncore_" prefix to detect if really uncore,
but this does not work for all uncore PMUs - maybe we should introduce
this kernel naming convention for future support.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 tools/perf/arch/arm64/util/arm-spe.c |  2 +-
 tools/perf/util/evsel.h              |  2 +-
 tools/perf/util/parse-events.c       | 12 ++++++------
 tools/perf/util/pmu.c                |  6 +++---
 tools/perf/util/pmu.h                |  2 +-
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
index eba6541ec0f1..4241ad6c9fa0 100644
--- a/tools/perf/arch/arm64/util/arm-spe.c
+++ b/tools/perf/arch/arm64/util/arm-spe.c
@@ -223,7 +223,7 @@ struct perf_event_attr
 	}
 
 	arm_spe_pmu->selectable = true;
-	arm_spe_pmu->is_uncore = false;
+	arm_spe_pmu->is_uncore_or_sys = false;
 
 	return attr;
 }
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index dc14f4a823cd..d583b2a64d93 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -75,7 +75,7 @@ struct evsel {
 	bool			precise_max;
 	bool			ignore_missing_thread;
 	bool			forced_leader;
-	bool			use_uncore_alias;
+	bool			use_uncore_or_system_alias;
 	/* parse modifier helper */
 	int			exclude_GH;
 	int			sample_read;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index ed7c008b9c8b..89105d5f0f0b 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -367,7 +367,7 @@ __add_event(struct list_head *list, int *idx,
 	(*idx)++;
 	evsel->core.cpus   = perf_cpu_map__get(cpus);
 	evsel->core.own_cpus = perf_cpu_map__get(cpus);
-	evsel->core.system_wide = pmu ? pmu->is_uncore : false;
+	evsel->core.system_wide = pmu ? pmu->is_uncore_or_sys : false;
 	evsel->auto_merge_stats = auto_merge_stats;
 
 	if (name)
@@ -1404,7 +1404,7 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,
 	struct perf_pmu *pmu;
 	struct evsel *evsel;
 	struct parse_events_error *err = parse_state->error;
-	bool use_uncore_alias;
+	bool use_uncore_or_system_alias;
 	LIST_HEAD(config_terms);
 
 	pmu = perf_pmu__find(name);
@@ -1425,7 +1425,7 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,
 		memset(&attr, 0, sizeof(attr));
 	}
 
-	use_uncore_alias = (pmu->is_uncore && use_alias);
+	use_uncore_or_system_alias = (pmu->is_uncore_or_sys && use_alias);
 
 	if (!head_config) {
 		attr.type = pmu->type;
@@ -1433,7 +1433,7 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,
 				    auto_merge_stats, NULL);
 		if (evsel) {
 			evsel->pmu_name = name;
-			evsel->use_uncore_alias = use_uncore_alias;
+			evsel->use_uncore_or_system_alias = use_uncore_or_system_alias;
 			return 0;
 		} else {
 			return -ENOMEM;
@@ -1481,7 +1481,7 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,
 		evsel->metric_expr = info.metric_expr;
 		evsel->metric_name = info.metric_name;
 		evsel->pmu_name = name;
-		evsel->use_uncore_alias = use_uncore_alias;
+		evsel->use_uncore_or_system_alias = use_uncore_or_system_alias;
 		evsel->percore = config_term_percore(&evsel->config_terms);
 	}
 
@@ -1598,7 +1598,7 @@ parse_events__set_leader_for_uncore_aliase(char *name, struct list_head *list,
 	__evlist__for_each_entry(list, evsel) {
 
 		/* Only split the uncore group which members use alias */
-		if (!evsel->use_uncore_alias)
+		if (!evsel->use_uncore_or_system_alias)
 			goto out;
 
 		/* The events must be from the same uncore block */
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 8b99fd312aae..569aba4cec89 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -623,7 +623,7 @@ static struct perf_cpu_map *pmu_cpumask(const char *name)
 	return NULL;
 }
 
-static bool pmu_is_uncore(const char *name)
+static bool pmu_is_uncore_or_sys(const char *name)
 {
 	char path[PATH_MAX];
 	const char *sysfs;
@@ -769,7 +769,7 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
 			break;
 		}
 
-		if (pmu_is_uncore(name) &&
+		if (pmu_is_uncore_or_sys(name) &&
 		    pmu_uncore_alias_match(pname, name))
 			goto new_alias;
 
@@ -838,7 +838,7 @@ static struct perf_pmu *pmu_lookup(const char *name)
 	pmu->cpus = pmu_cpumask(name);
 	pmu->name = strdup(name);
 	pmu->type = type;
-	pmu->is_uncore = pmu_is_uncore(name);
+	pmu->is_uncore_or_sys = pmu_is_uncore_or_sys(name);
 	pmu->max_precise = pmu_max_precise(name);
 	pmu_add_cpu_aliases(&aliases, pmu);
 
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 6737e3d5d568..67cf002c9458 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -25,7 +25,7 @@ struct perf_pmu {
 	char *name;
 	__u32 type;
 	bool selectable;
-	bool is_uncore;
+	bool is_uncore_or_sys;
 	bool auxtrace;
 	int max_precise;
 	struct perf_event_attr *default_config;
-- 
2.17.1


  parent reply	other threads:[~2020-01-24 14:39 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24 14:34 [PATCH RFC 0/7] perf pmu-events: Support event aliasing for " John Garry
2020-01-24 14:34 ` [PATCH RFC 1/7] perf jevents: Add support for an extra directory level John Garry
2020-02-10 12:07   ` Jiri Olsa
2020-02-10 15:47     ` John Garry
2020-01-24 14:35 ` [PATCH RFC 2/7] perf vendor events arm64: Relocate hip08 core events John Garry
2020-01-24 14:35 ` [PATCH RFC 3/7] perf jevents: Add support for a system events PMU John Garry
2020-02-10 12:07   ` Jiri Olsa
2020-02-10 12:07   ` Jiri Olsa
2020-02-10 15:55     ` John Garry
2020-02-11 14:46       ` Jiri Olsa
2020-01-24 14:35 ` John Garry [this message]
2020-02-10 12:07   ` [PATCH RFC 4/7] perf pmu: Rename uncore symbols to include system PMUs Jiri Olsa
2020-02-10 15:44     ` John Garry
2020-02-11 14:43       ` Jiri Olsa
2020-02-11 15:36         ` John Garry
2020-02-12 12:08           ` Jiri Olsa
2020-01-24 14:35 ` [PATCH RFC 5/7] perf pmu: Support matching by sysid John Garry
2020-02-10 12:07   ` Jiri Olsa
2020-02-10 16:22     ` John Garry
2020-02-11 13:47       ` Jiri Olsa
2020-02-11 15:07         ` John Garry
2020-02-12 10:08           ` John Garry
2020-02-12 12:16             ` Jiri Olsa
2020-02-12 12:24               ` John Garry
2020-01-24 14:35 ` [PATCH RFC 6/7] perf vendor events arm64: Relocate uncore events for hip08 John Garry
2020-01-24 14:35 ` [PATCH RFC 7/7] perf vendor events arm64: Add hip08 SMMUv3 PMCG IMP DEF events John Garry
2020-02-11 15:24 ` [PATCH RFC 0/7] perf pmu-events: Support event aliasing for system PMUs James Clark
2020-02-11 15:41   ` John Garry
2020-02-18 12:57 ` Will Deacon
2020-02-18 13:24   ` John Garry
2020-02-18 13:39     ` Will Deacon
2020-02-18 16:19       ` John Garry
2020-02-18 17:08         ` Mark Rutland
2020-02-18 17:58           ` John Garry
2020-02-18 18:13             ` Mark Rutland
2020-02-19  1:55               ` Joakim Zhang
2020-02-19  8:44                 ` John Garry
2020-02-19 12:40                   ` Joakim Zhang
2020-02-19 14:28                     ` John Garry
2020-02-19  8:50               ` John Garry

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=1579876505-113251-5-git-send-email-john.garry@huawei.com \
    --to=john.garry@huawei.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=robin.murphy@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    --cc=zhangshaokun@hisilicon.com \
    /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

all inboxes | Powered by JetHome®