perf vendor events amd: add L3 cache events for Family 17h
PATCH 1/5 perf vendor events amd: add L3 cache events for Family 17h
Allow users to symbolically specify L3 events for Family 17h processors using the existing AMD Uncore driver.
Source of events descriptions are from section 2.1.15.4.1 "L3 Cache PMC Events" of the latest Family 17h PPR, available here:
https://www.amd.com/system/files/TechDocs/55570-B1_PUB.zip
Only BriefDescriptions added, since they show with and without the -v and --details flags.
Tested with:
# perf stat -e l3_request_g1.caching_l3_cache_accesses,amd_l3/event=0x01,umask=0x80/,l3_comb_clstr_state.request_miss,amd_l3/event=0x06,umask=0x01/ perf bench mem memcpy -s 4mb -l 100 -f default
...
7,006,831 l3_request_g1.caching_l3_cache_accesses
7,006,830 amd_l3/event=0x01,umask=0x80/
366,530 l3_comb_clstr_state.request_miss
366,568 amd_l3/event=0x06,umask=0x01/--- .../pmu-events/arch/x86/amdfam17h/cache.json | 42 +++++++++++++++++++ tools/perf/pmu-events/jevents.c | 1 + 2 files changed, 43 insertions(+)
tools/perf/pmu-events/arch/x86/amdfam17h/cache.json +42 -0
@@ -283,5 +283,47 @@ "BriefDescription": "Total cycles spent with one or more fill requests in flight from L2.", "PublicDescription": "Total cycles spent with one or more fill requests in flight from L2.", "UMask": "0x1" + }, + { + "EventName": "l3_request_g1.caching_l3_cache_accesses", + "EventCode": "0x01", + "BriefDescription": "Caching: L3 cache accesses", + "UMask": "0x80", + "Unit": "L3PMC" + }, + { + "EventName": "l3_lookup_state.all_l3_req_typs", + "EventCode": "0x04", + "BriefDescription": "All L3 Request Types", + "UMask": "0xff", + "Unit": "L3PMC" + }, + { + "EventName": "l3_comb_clstr_state.other_l3_miss_typs", + "EventCode": "0x06", + "BriefDescription": "Other L3 Miss Request Types", + "UMask": "0xfe", + "Unit": "L3PMC" + }, + { + "EventName": "l3_comb_clstr_state.request_miss", + "EventCode": "0x06", + "BriefDescription": "L3 cache misses", + "UMask": "0x01", + "Unit": "L3PMC" + }, + { + "EventName": "xi_sys_fill_latency", + "EventCode": "0x90", + "BriefDescription": "L3 Cache Miss Latency. Total cycles for all transactions divided by 16. Ignores SliceMask and ThreadMask.", + "UMask": "0x00", + "Unit": "L3PMC" + }, + { + "EventName": "xi_ccx_sdp_req1.all_l3_miss_req_typs", + "EventCode": "0x9a", + "BriefDescription": "All L3 Miss Request Types. Ignores SliceMask and ThreadMask.", + "UMask": "0x3f", + "Unit": "L3PMC" } ]
tools/perf/pmu-events/jevents.c +1 -0
@@ -239,6 +239,7 @@ static struct map { { "hisi_sccl,ddrc", "hisi_sccl,ddrc" }, { "hisi_sccl,hha", "hisi_sccl,hha" }, { "hisi_sccl,l3c", "hisi_sccl,l3c" }, + { "L3PMC", "amd_l3" }, {} };
Signature · 1 line
2.23.0
PATCH 2/5 perf vendor events amd: remove redundant '['
Remove the redundant '['.
perf list output before:
ex_ret_brn
[[Retired Branch Instructions]
perf list output after:
ex_ret_brn
[Retired Branch Instructions]
--- tools/perf/pmu-events/arch/x86/amdfam17h/core.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/pmu-events/arch/x86/amdfam17h/core.json +1 -1
@@ -13,7 +13,7 @@ { "EventName": "ex_ret_brn", "EventCode": "0xc2", - "BriefDescription": "[Retired Branch Instructions.", + "BriefDescription": "Retired Branch Instructions.", "PublicDescription": "The number of branch instructions retired. This includes all types of architectural control flow changes, including exceptions and interrupts." }, {
Signature · 1 line
2.23.0
PATCH 3/5 perf vendor events: minor fixes to the README
In reply to Kim PhillipsSome grammatical fixes, and updates to some path references that have since changed.
--- tools/perf/pmu-events/README | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
tools/perf/pmu-events/README +11 -11
@@ -30,9 +30,9 @@ the topic. Eg: "Floating-point.json". All the topic JSON files for a CPU model/family should be in a separate sub directory. Thus for the Silvermont X86 CPU: - $ ls tools/perf/pmu-events/arch/x86/Silvermont_core - Cache.json Memory.json Virtual-Memory.json - Frontend.json Pipeline.json + $ ls tools/perf/pmu-events/arch/x86/silvermont + cache.json memory.json virtual-memory.json + frontend.json pipeline.json The JSONs folder for a CPU model/family may be placed in the root arch folder, or may be placed in a vendor sub-folder under the arch folder
@@ -94,7 +94,7 @@ users to specify events by their name: where 'pm_1plus_ppc_cmpl' is a Power8 PMU event. -However some errors in processing may cause the perf build to fail. +However some errors in processing may cause the alias build to fail. Mapfile format ===============
@@ -119,7 +119,7 @@ where: Header line The header line is the first line in the file, which is - always _IGNORED_. It can empty. + always _IGNORED_. It can be empty. CPUID: CPUID is an arch-specific char string, that can be used
@@ -138,15 +138,15 @@ where: files, relative to the directory containing the mapfile.csv Type: - indicates whether the events or "core" or "uncore" events. + indicates whether the events are "core" or "uncore" events. Eg: - $ grep Silvermont tools/perf/pmu-events/arch/x86/mapfile.csv - GenuineIntel-6-37,V13,Silvermont_core,core - GenuineIntel-6-4D,V13,Silvermont_core,core - GenuineIntel-6-4C,V13,Silvermont_core,core + $ grep silvermont tools/perf/pmu-events/arch/x86/mapfile.csv + GenuineIntel-6-37,v13,silvermont,core + GenuineIntel-6-4D,v13,silvermont,core + GenuineIntel-6-4C,v13,silvermont,core 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_core'. + in the directory 'tools/perf/pmu-events/arch/x86/silvermont'.
Signature · 1 line
2.23.0
Re: [PATCH 3/5] perf vendor events: minor fixes to the README
For all the patches except the last
Re: [PATCH 3/5] perf vendor events: minor fixes to the README
Em Thu, Sep 19, 2019 at 03:09:28PM -0700, Andi Kleen escreveu:
Quoted 3 lines
For all the patches except the last
Reviewed-by Andi Kleen <[email protected]>
Thanks, applying all but the last till we get that further discussed.
Signature · 1 line
- Arnaldo
PATCH 4/5 perf list: allow plurals for metric, metricgroup
In reply to Kim PhillipsEnhance usability by allowing the same plurality used in the output title, for the command line parameter.
BEFORE, perf deceitfully acts as if there are no metrics to be had:
$ perf list metrics
List of pre-defined events (to be used in -e):
Metric Groups:
$
But singular 'metric' shows a list of metrics:
$ perf list metric
List of pre-defined events (to be used in -e):
Metrics:
IPC
[Instructions Per Cycle (per logical thread)]
UPI
[Uops Per Instruction]
AFTER, when asking for 'metrics', we actually see the metrics get listed:
$ perf list metrics
List of pre-defined events (to be used in -e):
Metrics:
IPC
[Instructions Per Cycle (per logical thread)]
UPI
[Uops Per Instruction]
--- tools/perf/builtin-list.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-list.c +2 -2
@@ -81,9 +81,9 @@ int cmd_list(int argc, const char **argv) long_desc_flag, details_flag); else if (strcmp(argv[i], "sdt") == 0) print_sdt_events(NULL, NULL, raw_dump); - else if (strcmp(argv[i], "metric") == 0) + else if (strcmp(argv[i], "metric") == 0 || strcmp(argv[i], "metrics") == 0) metricgroup__print(true, false,NULL , raw_dump, details_flag); - else if (strcmp(argv[i], "metricgroup") == 0) + else if (strcmp(argv[i], "metricgroup") == 0 || strcmp(argv[i], "metricgroups") == 0) metricgroup__print(false, true,NULL , raw_dump, details_flag); else if ((sep = strchr(argv[i], ':')) != NULL) {int sep_idx;
Signature · 1 line
2.23.0
PATCH 5/5 perf list: specify metrics are to be used with -M
In reply to Kim PhillipsOutput of 'perf list metrics' before:
$ perf list metrics
List of pre-defined events (to be used in -e):
Metrics:
C2_Pkg_Residency
[C2 residency percent per package]
...
This misleads the uninitiated user to try:
$ perf stat -e C2_Pkg_Residency
which gets:
event syntax error: 'C2_Pkg_Residency'
\___ parser error
Run 'perf list' for a list of valid events
Explicitly clarify that metrics and metricgroups are meant to be used with -M, and correct the grammar for the -e equivalent statement.
Output of 'perf list metrics' after:
$ perf list metrics
List of pre-defined events (to be used with -e):
Metrics (to be used with -M):
C2_Pkg_Residency
[C2 residency percent per package]
...
--- tools/perf/builtin-list.c | 2 +- tools/perf/util/metricgroup.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
tools/perf/builtin-list.c +1 -1
@@ -51,7 +51,7 @@ int cmd_list(int argc, const char **argv)setup_pager ();if (!raw_dump &&pager_in_use ()) -printf ("\nList of pre-defined events (to be used in -e):\n\n" ); +printf ("\nList of pre-defined events (to be used with -e):\n\n" );if (argc ==0 ) { print_events(NULL, raw_dump, !desc_flag, long_desc_flag,
tools/perf/util/metricgroup.c +3 -2
@@ -377,9 +377,10 @@ void metricgroup__print(bool metrics, bool metricgroups, char *filter, }if (metricgroups && !raw) -printf ("\nMetric Groups:\n\n" ); +printf ("\nMetric Groups" );else if (metrics && !raw) -printf ("\nMetrics:\n\n" ); +printf ("\nMetrics" ); +printf (" (to be used with -M):\n\n" );for (node =rb_first_cached (&groups.entries); node; node = next) { struct mep *me = container_of(node, struct mep, nd);
Signature · 1 line
2.23.0
Re: [PATCH 5/5] perf list: specify metrics are to be used with -M
Quoted 3 lines
This misleads the uninitiated user to try:
$ perf stat -e C2_Pkg_Residency
Actually I guess we could just fix -e to support metrics too. Would probably not be that difficult.
-Andi