Re: [PATCH RFC 4/7] perf pmu: Rename uncore symbols to include system PMUs

From: Jiri Olsa
Date: Tue Feb 11 2020 - 09:43:25 EST


On Mon, Feb 10, 2020 at 03:44:48PM +0000, John Garry wrote:
> 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.

I see.. can't we just check sysid for uncore PMUs? because
that's what the code is doing, right? having pmu_is_uncore_or_sys
makes me think there's some sysid-type PMU

jirka