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

From: Jiri Olsa
Date: Wed Feb 12 2020 - 07:08:30 EST


On Tue, Feb 11, 2020 at 03:36:39PM +0000, John Garry wrote:
> On 11/02/2020 14:43, Jiri Olsa wrote:
> > > 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.
>
> Hi Jirka,
>
> > I see.. can't we just check sysid for uncore PMUs?
>
> x86 will still alias PMUs (uncore or CPU) based on an alias table matched to
> the cpuid, as it is today. x86 has the benefit of fixed uncore PMUs for a
> given cpuid.

ok, I did mean 'on addition' to the cpuid checks

>
> For other archs whose uncore or system PMUs are not fixed for a given CPU -
> like arm - we will support matching uncore and system PMUs on cpuid or
> sysid.
>
> Uncore PMUs are a grey area for arm, as they may or may not be tied to a
> specific cpuid, so we will need to support both matching methods.
>
> because
> > that's what the code is doing, right?
>
> Not exactly.
>
> The code will match on an alias table matched to the cpuid and also an alias
> table matched to the sysid (if perf could actually get a sysid and there is
> a table matching that sysid).
>
> I hope that this makes sense....

right, please make sure this kind of explanation is in changelog
or better in the code comment

thanks,
jirka