Re: [PATCH RFC 3/7] perf jevents: Add support for a system events PMU

From: John Garry
Date: Mon Feb 10 2020 - 10:55:07 EST


On 10/02/2020 12:07, Jiri Olsa wrote:
On Fri, Jan 24, 2020 at 10:35:01PM +0800, John Garry wrote:

SNIP

- Set of 'PMU events tables' for all known CPUs in the architecture,
@@ -83,11 +93,11 @@ NOTES:
2. The 'pmu-events.h' has an extern declaration for the mapping table
and the generated 'pmu-events.c' defines this table.
- 3. _All_ known CPU tables for architecture are included in the perf
- binary.
+ 3. _All_ known CPU and system tables for architecture are included in
+ the perf binary.
-At run time, perf determines the actual CPU it is running on, finds the
-matching events table and builds aliases for those events. This allows
+At run time, perf determines the actual CPU or system it is running on, finds
+the matching events table and builds aliases for those events. This allows
users to specify events by their name:
$ perf stat -e pm_1plus_ppc_cmpl sleep 1
@@ -150,3 +160,18 @@ where:
i.e the three CPU models use the JSON files (i.e PMU events) listed
in the directory 'tools/perf/pmu-events/arch/x86/silvermont'.
+
+The mapfile_sys.csv format is slightly different, in that it contains a SYSID
+instead of the CPUID:
+
+ Header line
+ SYSID,Version,Dir/path/name,Type


Hi jirka,

can't we just add prefix to SYSID types? like:

SYSID-HIP08,v1,hisilicon/hip08/sys,sys
0x00000000480fd010,v1,hisilicon/hip08/cpu,core
0x00000000500f0000,v1,ampere/emag,core

because the rest of the line is the same, right?

I did consider that already. It should be workable.


seems to me that having one mapfile type would be less confusing

I thought that having it all in a single file would be more confusing :)


As for this separate comment:

>> + if (!strcmp(bname, "mapfile_sys.csv")) {
>> + mapfile_sys = strdup(fpath);
>
>
> we could release that in the cleanup code at the end of main
> together with 'mapfile',

That should now go away.

> which is also missing

Right, I'll look to fix that.

Thanks,
John

.