Re: [PATCH RFC 4/7] perf pmu: Rename uncore symbols to include system PMUs
From: John Garry
Date: Mon Feb 10 2020 - 10:44:53 EST
On 10/02/2020 12:07, Jiri Olsa wrote:
On Fri, Jan 24, 2020 at 10:35:02PM +0800, John Garry wrote:
SNIP
/* 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)
Hi jirka,
so we detect uncore PMU by checking for cpumask file
For PMUs which could be considered "system" PMUs, they also have a
cpumask, like the PMU I use as motivation for this series:
root@(none)$ pwd
/sys/bus/event_source/devices/smmuv3_pmcg_100020
root@(none)$ ls -l
total 0
-r--r--r-- 1 root root 4096 Feb 10 14:50 cpumask
drwxr-xr-x 2 root root 0 Feb 10 14:50 events
drwxr-xr-x 2 root root 0 Feb 10 14:50 format
-rw-r--r-- 1 root root 4096 Feb 10 14:50
perf_event_mux_interval_ms
drwxr-xr-x 2 root root 0 Feb 10 14:50 power
lrwxrwxrwx 1 root root 0 Feb 10 14:50 subsystem ->
../../bus/event_source
-r--r--r-- 1 root root 4096 Feb 10 14:50 type
-rw-r--r-- 1 root root 4096 Feb 10 14:50 uevent
Other PMU drivers which I have checked in drivers/perf also have the same.
Indeed I see no way to differentiate whether a PMU is an uncore or
system. So that is why I change the name to cover both. Maybe there is a
better name than the verbose pmu_is_uncore_or_sys().
I don't see the connection here with the sysid or '_sys' checking,
that's just telling which ID to use when looking for an alias, no?
So the connection is that in perf_pmu__find_map(), for a given PMU, the
matching is now extended from only core or uncore PMUs to also these
system PMUs. And I use the sysid to find an aliasing table for any
system PMUs present.
shouldn't that be separated?
Yes, I now think that this would be a better option. So currently I am
combining it and it causes a problem, like I have noted in patch #5:
struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
{
[SNIP]
sysid = perf_pmu__getsysid();
/*
* Match sysid as first perference for uncore/sys PMUs.
*
* x86 uncore events match by cpuid, but we would not have map->socid
* set for that arch (so any matching here would fail for that).
*/
if (pmu && pmu_is_uncore_or_sys(pmu->name) &&
!is_arm_pmu_core(pmu->name) && sysid) {
Thanks,
John