Commit 2e255b4f authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf jevents: Group events by PMU

Prior to this change a cpuid would map to a list of events where the PMU
would be encoded alongside the event information. This change breaks
apart each group of events so that there is a group per PMU. A new table
is added with the PMU's name and the list of events, the original table
now holding an array of these per PMU tables.

These changes are to make it easier to get per PMU information about
events, rather than the current approach of scanning all events. The
perf binary size with BPF skeletons on x86 is reduced by about 1%. The
unidentified PMU is now always expanded to "cpu".
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230824041330.266337-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 4000519e
This diff is collapsed.
...@@ -44,6 +44,7 @@ struct perf_pmu_test_pmu { ...@@ -44,6 +44,7 @@ struct perf_pmu_test_pmu {
static const struct perf_pmu_test_event bp_l1_btb_correct = { static const struct perf_pmu_test_event bp_l1_btb_correct = {
.event = { .event = {
.pmu = "cpu",
.name = "bp_l1_btb_correct", .name = "bp_l1_btb_correct",
.event = "event=0x8a", .event = "event=0x8a",
.desc = "L1 BTB Correction", .desc = "L1 BTB Correction",
...@@ -55,6 +56,7 @@ static const struct perf_pmu_test_event bp_l1_btb_correct = { ...@@ -55,6 +56,7 @@ static const struct perf_pmu_test_event bp_l1_btb_correct = {
static const struct perf_pmu_test_event bp_l2_btb_correct = { static const struct perf_pmu_test_event bp_l2_btb_correct = {
.event = { .event = {
.pmu = "cpu",
.name = "bp_l2_btb_correct", .name = "bp_l2_btb_correct",
.event = "event=0x8b", .event = "event=0x8b",
.desc = "L2 BTB Correction", .desc = "L2 BTB Correction",
...@@ -66,6 +68,7 @@ static const struct perf_pmu_test_event bp_l2_btb_correct = { ...@@ -66,6 +68,7 @@ static const struct perf_pmu_test_event bp_l2_btb_correct = {
static const struct perf_pmu_test_event segment_reg_loads_any = { static const struct perf_pmu_test_event segment_reg_loads_any = {
.event = { .event = {
.pmu = "cpu",
.name = "segment_reg_loads.any", .name = "segment_reg_loads.any",
.event = "event=0x6,period=200000,umask=0x80", .event = "event=0x6,period=200000,umask=0x80",
.desc = "Number of segment register loads", .desc = "Number of segment register loads",
...@@ -77,6 +80,7 @@ static const struct perf_pmu_test_event segment_reg_loads_any = { ...@@ -77,6 +80,7 @@ static const struct perf_pmu_test_event segment_reg_loads_any = {
static const struct perf_pmu_test_event dispatch_blocked_any = { static const struct perf_pmu_test_event dispatch_blocked_any = {
.event = { .event = {
.pmu = "cpu",
.name = "dispatch_blocked.any", .name = "dispatch_blocked.any",
.event = "event=0x9,period=200000,umask=0x20", .event = "event=0x9,period=200000,umask=0x20",
.desc = "Memory cluster signals to block micro-op dispatch for any reason", .desc = "Memory cluster signals to block micro-op dispatch for any reason",
...@@ -88,6 +92,7 @@ static const struct perf_pmu_test_event dispatch_blocked_any = { ...@@ -88,6 +92,7 @@ static const struct perf_pmu_test_event dispatch_blocked_any = {
static const struct perf_pmu_test_event eist_trans = { static const struct perf_pmu_test_event eist_trans = {
.event = { .event = {
.pmu = "cpu",
.name = "eist_trans", .name = "eist_trans",
.event = "event=0x3a,period=200000,umask=0x0", .event = "event=0x3a,period=200000,umask=0x0",
.desc = "Number of Enhanced Intel SpeedStep(R) Technology (EIST) transitions", .desc = "Number of Enhanced Intel SpeedStep(R) Technology (EIST) transitions",
...@@ -99,6 +104,7 @@ static const struct perf_pmu_test_event eist_trans = { ...@@ -99,6 +104,7 @@ static const struct perf_pmu_test_event eist_trans = {
static const struct perf_pmu_test_event l3_cache_rd = { static const struct perf_pmu_test_event l3_cache_rd = {
.event = { .event = {
.pmu = "cpu",
.name = "l3_cache_rd", .name = "l3_cache_rd",
.event = "event=0x40", .event = "event=0x40",
.desc = "L3 cache access, read", .desc = "L3 cache access, read",
...@@ -123,7 +129,7 @@ static const struct perf_pmu_test_event uncore_hisi_ddrc_flux_wcmd = { ...@@ -123,7 +129,7 @@ static const struct perf_pmu_test_event uncore_hisi_ddrc_flux_wcmd = {
.event = { .event = {
.name = "uncore_hisi_ddrc.flux_wcmd", .name = "uncore_hisi_ddrc.flux_wcmd",
.event = "event=0x2", .event = "event=0x2",
.desc = "DDRC write commands. Unit: hisi_sccl,ddrc ", .desc = "DDRC write commands. Unit: hisi_sccl,ddrc",
.topic = "uncore", .topic = "uncore",
.long_desc = "DDRC write commands", .long_desc = "DDRC write commands",
.pmu = "hisi_sccl,ddrc", .pmu = "hisi_sccl,ddrc",
...@@ -137,7 +143,7 @@ static const struct perf_pmu_test_event unc_cbo_xsnp_response_miss_eviction = { ...@@ -137,7 +143,7 @@ static const struct perf_pmu_test_event unc_cbo_xsnp_response_miss_eviction = {
.event = { .event = {
.name = "unc_cbo_xsnp_response.miss_eviction", .name = "unc_cbo_xsnp_response.miss_eviction",
.event = "event=0x22,umask=0x81", .event = "event=0x22,umask=0x81",
.desc = "A cross-core snoop resulted from L3 Eviction which misses in some processor core. Unit: uncore_cbox ", .desc = "A cross-core snoop resulted from L3 Eviction which misses in some processor core. Unit: uncore_cbox",
.topic = "uncore", .topic = "uncore",
.long_desc = "A cross-core snoop resulted from L3 Eviction which misses in some processor core", .long_desc = "A cross-core snoop resulted from L3 Eviction which misses in some processor core",
.pmu = "uncore_cbox", .pmu = "uncore_cbox",
...@@ -151,7 +157,7 @@ static const struct perf_pmu_test_event uncore_hyphen = { ...@@ -151,7 +157,7 @@ static const struct perf_pmu_test_event uncore_hyphen = {
.event = { .event = {
.name = "event-hyphen", .name = "event-hyphen",
.event = "event=0xe0,umask=0x00", .event = "event=0xe0,umask=0x00",
.desc = "UNC_CBO_HYPHEN. Unit: uncore_cbox ", .desc = "UNC_CBO_HYPHEN. Unit: uncore_cbox",
.topic = "uncore", .topic = "uncore",
.long_desc = "UNC_CBO_HYPHEN", .long_desc = "UNC_CBO_HYPHEN",
.pmu = "uncore_cbox", .pmu = "uncore_cbox",
...@@ -165,7 +171,7 @@ static const struct perf_pmu_test_event uncore_two_hyph = { ...@@ -165,7 +171,7 @@ static const struct perf_pmu_test_event uncore_two_hyph = {
.event = { .event = {
.name = "event-two-hyph", .name = "event-two-hyph",
.event = "event=0xc0,umask=0x00", .event = "event=0xc0,umask=0x00",
.desc = "UNC_CBO_TWO_HYPH. Unit: uncore_cbox ", .desc = "UNC_CBO_TWO_HYPH. Unit: uncore_cbox",
.topic = "uncore", .topic = "uncore",
.long_desc = "UNC_CBO_TWO_HYPH", .long_desc = "UNC_CBO_TWO_HYPH",
.pmu = "uncore_cbox", .pmu = "uncore_cbox",
...@@ -179,7 +185,7 @@ static const struct perf_pmu_test_event uncore_hisi_l3c_rd_hit_cpipe = { ...@@ -179,7 +185,7 @@ static const struct perf_pmu_test_event uncore_hisi_l3c_rd_hit_cpipe = {
.event = { .event = {
.name = "uncore_hisi_l3c.rd_hit_cpipe", .name = "uncore_hisi_l3c.rd_hit_cpipe",
.event = "event=0x7", .event = "event=0x7",
.desc = "Total read hits. Unit: hisi_sccl,l3c ", .desc = "Total read hits. Unit: hisi_sccl,l3c",
.topic = "uncore", .topic = "uncore",
.long_desc = "Total read hits", .long_desc = "Total read hits",
.pmu = "hisi_sccl,l3c", .pmu = "hisi_sccl,l3c",
...@@ -193,7 +199,7 @@ static const struct perf_pmu_test_event uncore_imc_free_running_cache_miss = { ...@@ -193,7 +199,7 @@ static const struct perf_pmu_test_event uncore_imc_free_running_cache_miss = {
.event = { .event = {
.name = "uncore_imc_free_running.cache_miss", .name = "uncore_imc_free_running.cache_miss",
.event = "event=0x12", .event = "event=0x12",
.desc = "Total cache misses. Unit: uncore_imc_free_running ", .desc = "Total cache misses. Unit: uncore_imc_free_running",
.topic = "uncore", .topic = "uncore",
.long_desc = "Total cache misses", .long_desc = "Total cache misses",
.pmu = "uncore_imc_free_running", .pmu = "uncore_imc_free_running",
...@@ -207,7 +213,7 @@ static const struct perf_pmu_test_event uncore_imc_cache_hits = { ...@@ -207,7 +213,7 @@ static const struct perf_pmu_test_event uncore_imc_cache_hits = {
.event = { .event = {
.name = "uncore_imc.cache_hits", .name = "uncore_imc.cache_hits",
.event = "event=0x34", .event = "event=0x34",
.desc = "Total cache hits. Unit: uncore_imc ", .desc = "Total cache hits. Unit: uncore_imc",
.topic = "uncore", .topic = "uncore",
.long_desc = "Total cache hits", .long_desc = "Total cache hits",
.pmu = "uncore_imc", .pmu = "uncore_imc",
...@@ -232,13 +238,13 @@ static const struct perf_pmu_test_event sys_ddr_pmu_write_cycles = { ...@@ -232,13 +238,13 @@ static const struct perf_pmu_test_event sys_ddr_pmu_write_cycles = {
.event = { .event = {
.name = "sys_ddr_pmu.write_cycles", .name = "sys_ddr_pmu.write_cycles",
.event = "event=0x2b", .event = "event=0x2b",
.desc = "ddr write-cycles event. Unit: uncore_sys_ddr_pmu ", .desc = "ddr write-cycles event. Unit: uncore_sys_ddr_pmu",
.topic = "uncore", .topic = "uncore",
.pmu = "uncore_sys_ddr_pmu", .pmu = "uncore_sys_ddr_pmu",
.compat = "v8", .compat = "v8",
}, },
.alias_str = "event=0x2b", .alias_str = "event=0x2b",
.alias_long_desc = "ddr write-cycles event. Unit: uncore_sys_ddr_pmu ", .alias_long_desc = "ddr write-cycles event. Unit: uncore_sys_ddr_pmu",
.matching_pmu = "uncore_sys_ddr_pmu", .matching_pmu = "uncore_sys_ddr_pmu",
}; };
...@@ -246,13 +252,13 @@ static const struct perf_pmu_test_event sys_ccn_pmu_read_cycles = { ...@@ -246,13 +252,13 @@ static const struct perf_pmu_test_event sys_ccn_pmu_read_cycles = {
.event = { .event = {
.name = "sys_ccn_pmu.read_cycles", .name = "sys_ccn_pmu.read_cycles",
.event = "config=0x2c", .event = "config=0x2c",
.desc = "ccn read-cycles event. Unit: uncore_sys_ccn_pmu ", .desc = "ccn read-cycles event. Unit: uncore_sys_ccn_pmu",
.topic = "uncore", .topic = "uncore",
.pmu = "uncore_sys_ccn_pmu", .pmu = "uncore_sys_ccn_pmu",
.compat = "0x01", .compat = "0x01",
}, },
.alias_str = "config=0x2c", .alias_str = "config=0x2c",
.alias_long_desc = "ccn read-cycles event. Unit: uncore_sys_ccn_pmu ", .alias_long_desc = "ccn read-cycles event. Unit: uncore_sys_ccn_pmu",
.matching_pmu = "uncore_sys_ccn_pmu", .matching_pmu = "uncore_sys_ccn_pmu",
}; };
...@@ -403,7 +409,7 @@ static int test__pmu_event_table_core_callback(const struct pmu_event *pe, ...@@ -403,7 +409,7 @@ static int test__pmu_event_table_core_callback(const struct pmu_event *pe,
struct perf_pmu_test_event const **test_event_table; struct perf_pmu_test_event const **test_event_table;
bool found = false; bool found = false;
if (pe->pmu) if (strcmp(pe->pmu, "cpu"))
test_event_table = &uncore_events[0]; test_event_table = &uncore_events[0];
else else
test_event_table = &core_events[0]; test_event_table = &core_events[0];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment