Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf pmu-events: Hide the pmu_events

Hide that the pmu_event structs are an array with a new wrapper struct.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.garry@huawei.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Will Deacon <will@kernel.org>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20220812230949.683239-12-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
1ba3752a 660842e4

+101 -91
+1 -1
tools/perf/arch/arm64/util/pmu.c
··· 3 3 #include "../../../util/cpumap.h" 4 4 #include "../../../util/pmu.h" 5 5 6 - const struct pmu_event *pmu_events_table__find(void) 6 + const struct pmu_events_table *pmu_events_table__find(void) 7 7 { 8 8 struct perf_pmu *pmu = NULL; 9 9
+24 -20
tools/perf/pmu-events/empty-pmu-events.c
··· 176 176 }, 177 177 }; 178 178 179 + /* Struct used to make the PMU event table implementation opaque to callers. */ 180 + struct pmu_events_table { 181 + const struct pmu_event *entries; 182 + }; 179 183 180 184 /* 181 185 * Map a CPU to its table of PMU events. The CPU is identified by the ··· 192 188 struct pmu_events_map { 193 189 const char *arch; 194 190 const char *cpuid; 195 - const struct pmu_event *table; 191 + const struct pmu_events_table table; 196 192 }; 197 193 198 194 /* ··· 203 199 { 204 200 .arch = "testarch", 205 201 .cpuid = "testcpu", 206 - .table = pme_test_soc_cpu, 202 + .table = { pme_test_soc_cpu }, 207 203 }, 208 204 { 209 205 .arch = 0, 210 206 .cpuid = 0, 211 - .table = 0, 207 + .table = { 0 }, 212 208 }, 213 209 }; 214 210 ··· 238 234 239 235 struct pmu_sys_events { 240 236 const char *name; 241 - const struct pmu_event *table; 237 + const struct pmu_events_table table; 242 238 }; 243 239 244 240 static const struct pmu_sys_events pmu_sys_event_tables[] = { 245 241 { 246 - .table = pme_test_soc_sys, 242 + .table = { pme_test_soc_sys }, 247 243 .name = "pme_test_soc_sys", 248 244 }, 249 245 { 250 - .table = 0 246 + .table = { 0 } 251 247 }, 252 248 }; 253 249 254 - int pmu_events_table_for_each_event(const struct pmu_event *table, pmu_event_iter_fn fn, 250 + int pmu_events_table_for_each_event(const struct pmu_events_table *table, pmu_event_iter_fn fn, 255 251 void *data) 256 252 { 257 - for (const struct pmu_event *pe = &table[0]; 253 + for (const struct pmu_event *pe = &table->entries[0]; 258 254 pe->name || pe->metric_group || pe->metric_name; 259 255 pe++) { 260 256 int ret = fn(pe, table, data); ··· 265 261 return 0; 266 262 } 267 263 268 - const struct pmu_event *perf_pmu__find_table(struct perf_pmu *pmu) 264 + const struct pmu_events_table *perf_pmu__find_table(struct perf_pmu *pmu) 269 265 { 270 - const struct pmu_event *table = NULL; 266 + const struct pmu_events_table *table = NULL; 271 267 char *cpuid = perf_pmu__getcpuid(pmu); 272 268 int i; 273 269 ··· 281 277 for (;;) { 282 278 const struct pmu_events_map *map = &pmu_events_map[i++]; 283 279 284 - if (!map->table) 280 + if (!map->cpuid) 285 281 break; 286 282 287 283 if (!strcmp_cpuid_str(map->cpuid, cpuid)) { 288 - table = map->table; 284 + table = &map->table; 289 285 break; 290 286 } 291 287 } ··· 293 289 return table; 294 290 } 295 291 296 - const struct pmu_event *find_core_events_table(const char *arch, const char *cpuid) 292 + const struct pmu_events_table *find_core_events_table(const char *arch, const char *cpuid) 297 293 { 298 294 for (const struct pmu_events_map *tables = &pmu_events_map[0]; 299 - tables->table; 295 + tables->arch; 300 296 tables++) { 301 297 if (!strcmp(tables->arch, arch) && !strcmp_cpuid_str(tables->cpuid, cpuid)) 302 - return tables->table; 298 + return &tables->table; 303 299 } 304 300 return NULL; 305 301 } ··· 307 303 int pmu_for_each_core_event(pmu_event_iter_fn fn, void *data) 308 304 { 309 305 for (const struct pmu_events_map *tables = &pmu_events_map[0]; 310 - tables->table; 306 + tables->arch; 311 307 tables++) { 312 - int ret = pmu_events_table_for_each_event(tables->table, fn, data); 308 + int ret = pmu_events_table_for_each_event(&tables->table, fn, data); 313 309 314 310 if (ret) 315 311 return ret; ··· 317 313 return 0; 318 314 } 319 315 320 - const struct pmu_event *find_sys_events_table(const char *name) 316 + const struct pmu_events_table *find_sys_events_table(const char *name) 321 317 { 322 318 for (const struct pmu_sys_events *tables = &pmu_sys_event_tables[0]; 323 319 tables->name; 324 320 tables++) { 325 321 if (!strcmp(tables->name, name)) 326 - return tables->table; 322 + return &tables->table; 327 323 } 328 324 return NULL; 329 325 } ··· 333 329 for (const struct pmu_sys_events *tables = &pmu_sys_event_tables[0]; 334 330 tables->name; 335 331 tables++) { 336 - int ret = pmu_events_table_for_each_event(tables->table, fn, data); 332 + int ret = pmu_events_table_for_each_event(&tables->table, fn, data); 337 333 338 334 if (ret) 339 335 return ret;
+26 -21
tools/perf/pmu-events/jevents.py
··· 335 335 def print_mapping_table(archs: Sequence[str]) -> None: 336 336 """Read the mapfile and generate the struct from cpuid string to event table.""" 337 337 _args.output_file.write(""" 338 + /* Struct used to make the PMU event table implementation opaque to callers. */ 339 + struct pmu_events_table { 340 + const struct pmu_event *entries; 341 + }; 342 + 338 343 /* 339 344 * Map a CPU to its table of PMU events. The CPU is identified by the 340 345 * cpuid field, which is an arch-specific identifier for the CPU. ··· 351 346 struct pmu_events_map { 352 347 const char *arch; 353 348 const char *cpuid; 354 - const struct pmu_event *table; 349 + struct pmu_events_table table; 355 350 }; 356 351 357 352 /* ··· 365 360 _args.output_file.write("""{ 366 361 \t.arch = "testarch", 367 362 \t.cpuid = "testcpu", 368 - \t.table = pme_test_soc_cpu, 363 + \t.table = { pme_test_soc_cpu }, 369 364 }, 370 365 """) 371 366 else: ··· 380 375 _args.output_file.write(f"""{{ 381 376 \t.arch = "{arch}", 382 377 \t.cpuid = "{cpuid}", 383 - \t.table = {tblname} 378 + \t.table = {{ {tblname} }} 384 379 }}, 385 380 """) 386 381 first = False ··· 388 383 _args.output_file.write("""{ 389 384 \t.arch = 0, 390 385 \t.cpuid = 0, 391 - \t.table = 0, 386 + \t.table = { 0 }, 392 387 } 393 388 }; 394 389 """) ··· 399 394 _args.output_file.write(""" 400 395 struct pmu_sys_events { 401 396 \tconst char *name; 402 - \tconst struct pmu_event *table; 397 + \tstruct pmu_events_table table; 403 398 }; 404 399 405 400 static const struct pmu_sys_events pmu_sys_event_tables[] = { 406 401 """) 407 402 for tblname in _sys_event_tables: 408 403 _args.output_file.write(f"""\t{{ 409 - \t\t.table = {tblname}, 404 + \t\t.table = {{ {tblname} }}, 410 405 \t\t.name = \"{tblname}\", 411 406 \t}}, 412 407 """) 413 408 _args.output_file.write("""\t{ 414 - \t\t.table = 0 409 + \t\t.table = { 0 } 415 410 \t}, 416 411 }; 417 412 418 - int pmu_events_table_for_each_event(const struct pmu_event *table, pmu_event_iter_fn fn, 413 + int pmu_events_table_for_each_event(const struct pmu_events_table *table, pmu_event_iter_fn fn, 419 414 void *data) 420 415 { 421 - for (const struct pmu_event *pe = &table[0]; 416 + for (const struct pmu_event *pe = &table->entries[0]; 422 417 pe->name || pe->metric_group || pe->metric_name; 423 418 pe++) { 424 419 int ret = fn(pe, table, data); ··· 429 424 return 0; 430 425 } 431 426 432 - const struct pmu_event *perf_pmu__find_table(struct perf_pmu *pmu) 427 + const struct pmu_events_table *perf_pmu__find_table(struct perf_pmu *pmu) 433 428 { 434 - const struct pmu_event *table = NULL; 429 + const struct pmu_events_table *table = NULL; 435 430 char *cpuid = perf_pmu__getcpuid(pmu); 436 431 int i; 437 432 ··· 444 439 i = 0; 445 440 for (;;) { 446 441 const struct pmu_events_map *map = &pmu_events_map[i++]; 447 - if (!map->table) 442 + if (!map->arch) 448 443 break; 449 444 450 445 if (!strcmp_cpuid_str(map->cpuid, cpuid)) { 451 - table = map->table; 446 + table = &map->table; 452 447 break; 453 448 } 454 449 } ··· 456 451 return table; 457 452 } 458 453 459 - const struct pmu_event *find_core_events_table(const char *arch, const char *cpuid) 454 + const struct pmu_events_table *find_core_events_table(const char *arch, const char *cpuid) 460 455 { 461 456 for (const struct pmu_events_map *tables = &pmu_events_map[0]; 462 - tables->table; 457 + tables->arch; 463 458 tables++) { 464 459 if (!strcmp(tables->arch, arch) && !strcmp_cpuid_str(tables->cpuid, cpuid)) 465 - return tables->table; 460 + return &tables->table; 466 461 } 467 462 return NULL; 468 463 } ··· 470 465 int pmu_for_each_core_event(pmu_event_iter_fn fn, void *data) 471 466 { 472 467 for (const struct pmu_events_map *tables = &pmu_events_map[0]; 473 - tables->table; 468 + tables->arch; 474 469 tables++) { 475 - int ret = pmu_events_table_for_each_event(tables->table, fn, data); 470 + int ret = pmu_events_table_for_each_event(&tables->table, fn, data); 476 471 477 472 if (ret) 478 473 return ret; ··· 480 475 return 0; 481 476 } 482 477 483 - const struct pmu_event *find_sys_events_table(const char *name) 478 + const struct pmu_events_table *find_sys_events_table(const char *name) 484 479 { 485 480 for (const struct pmu_sys_events *tables = &pmu_sys_event_tables[0]; 486 481 tables->name; 487 482 tables++) { 488 483 if (!strcmp(tables->name, name)) 489 - return tables->table; 484 + return &tables->table; 490 485 } 491 486 return NULL; 492 487 } ··· 496 491 for (const struct pmu_sys_events *tables = &pmu_sys_event_tables[0]; 497 492 tables->name; 498 493 tables++) { 499 - int ret = pmu_events_table_for_each_event(tables->table, fn, data); 494 + int ret = pmu_events_table_for_each_event(&tables->table, fn, data); 500 495 501 496 if (ret) 502 497 return ret;
+7 -5
tools/perf/pmu-events/pmu-events.h
··· 30 30 const char *metric_constraint; 31 31 }; 32 32 33 + struct pmu_events_table; 34 + 33 35 typedef int (*pmu_event_iter_fn)(const struct pmu_event *pe, 34 - const struct pmu_event *table, 36 + const struct pmu_events_table *table, 35 37 void *data); 36 38 37 - int pmu_events_table_for_each_event(const struct pmu_event *table, pmu_event_iter_fn fn, 39 + int pmu_events_table_for_each_event(const struct pmu_events_table *table, pmu_event_iter_fn fn, 38 40 void *data); 39 41 40 - const struct pmu_event *perf_pmu__find_table(struct perf_pmu *pmu); 41 - const struct pmu_event *find_core_events_table(const char *arch, const char *cpuid); 42 + const struct pmu_events_table *perf_pmu__find_table(struct perf_pmu *pmu); 43 + const struct pmu_events_table *find_core_events_table(const char *arch, const char *cpuid); 42 44 int pmu_for_each_core_event(pmu_event_iter_fn fn, void *data); 43 45 44 - const struct pmu_event *find_sys_events_table(const char *name); 46 + const struct pmu_events_table *find_sys_events_table(const char *name); 45 47 int pmu_for_each_sys_event(pmu_event_iter_fn fn, void *data); 46 48 47 49 #endif
+1 -1
tools/perf/tests/expand-cgroup.c
··· 180 180 struct evlist *evlist; 181 181 struct rblist metric_events; 182 182 const char metric_str[] = "CPI"; 183 - const struct pmu_event *pme_test; 183 + const struct pmu_events_table *pme_test; 184 184 185 185 evlist = evlist__new(); 186 186 TEST_ASSERT_VAL("failed to get evlist", evlist);
+1 -1
tools/perf/tests/parse-metric.c
··· 72 72 struct rblist metric_events = { 73 73 .nr_entries = 0, 74 74 }; 75 - const struct pmu_event *pme_test; 75 + const struct pmu_events_table *pme_test; 76 76 struct perf_cpu_map *cpus; 77 77 struct runtime_stat st; 78 78 struct evlist *evlist;
+8 -8
tools/perf/tests/pmu-events.c
··· 424 424 } 425 425 426 426 static int test__pmu_event_table_core_callback(const struct pmu_event *pe, 427 - const struct pmu_event *table __maybe_unused, 427 + const struct pmu_events_table *table __maybe_unused, 428 428 void *data) 429 429 { 430 430 int *map_events = data; ··· 461 461 } 462 462 463 463 static int test__pmu_event_table_sys_callback(const struct pmu_event *pe, 464 - const struct pmu_event *table __maybe_unused, 464 + const struct pmu_events_table *table __maybe_unused, 465 465 void *data) 466 466 { 467 467 int *map_events = data; ··· 495 495 static int test__pmu_event_table(struct test_suite *test __maybe_unused, 496 496 int subtest __maybe_unused) 497 497 { 498 - const struct pmu_event *sys_event_table = find_sys_events_table("pme_test_soc_sys"); 499 - const struct pmu_event *table = find_core_events_table("testarch", "testcpu"); 498 + const struct pmu_events_table *sys_event_table = find_sys_events_table("pme_test_soc_sys"); 499 + const struct pmu_events_table *table = find_core_events_table("testarch", "testcpu"); 500 500 int map_events = 0, expected_events, err; 501 501 502 502 /* ignore 3x sentinels */ ··· 544 544 struct perf_pmu *pmu; 545 545 LIST_HEAD(aliases); 546 546 int res = 0; 547 - const struct pmu_event *table = find_core_events_table("testarch", "testcpu"); 547 + const struct pmu_events_table *table = find_core_events_table("testarch", "testcpu"); 548 548 struct perf_pmu_alias *a, *tmp; 549 549 550 550 if (!table) ··· 597 597 struct perf_pmu *pmu = &test_pmu->pmu; 598 598 const char *pmu_name = pmu->name; 599 599 struct perf_pmu_alias *a, *tmp, *alias; 600 - const struct pmu_event *events_table; 600 + const struct pmu_events_table *events_table; 601 601 LIST_HEAD(aliases); 602 602 int res = 0; 603 603 ··· 839 839 struct metric_ref metric_ref; 840 840 }; 841 841 842 - static int test__parsing_callback(const struct pmu_event *pe, const struct pmu_event *table, 842 + static int test__parsing_callback(const struct pmu_event *pe, const struct pmu_events_table *table, 843 843 void *data) 844 844 { 845 845 int *failures = data; ··· 1016 1016 } 1017 1017 1018 1018 static int test__parsing_fake_callback(const struct pmu_event *pe, 1019 - const struct pmu_event *table __maybe_unused, 1019 + const struct pmu_events_table *table __maybe_unused, 1020 1020 void *data __maybe_unused) 1021 1021 { 1022 1022 if (!pe->metric_expr)
+21 -21
tools/perf/util/metricgroup.c
··· 508 508 }; 509 509 510 510 static int metricgroup__sys_event_iter(const struct pmu_event *pe, 511 - const struct pmu_event *table __maybe_unused, 511 + const struct pmu_events_table *table, 512 512 void *data) 513 513 { 514 514 struct metricgroup_iter_data *d = data; ··· 529 529 } 530 530 531 531 static int metricgroup__print_sys_event_iter(const struct pmu_event *pe, 532 - const struct pmu_event *table __maybe_unused, 532 + const struct pmu_events_table *table __maybe_unused, 533 533 void *data) 534 534 { 535 535 struct metricgroup_print_sys_idata *d = data; ··· 549 549 }; 550 550 551 551 static int metricgroup__print_callback(const struct pmu_event *pe, 552 - const struct pmu_event *table __maybe_unused, 552 + const struct pmu_events_table *table __maybe_unused, 553 553 void *vdata) 554 554 { 555 555 struct metricgroup_print_data *data = vdata; ··· 571 571 struct rblist groups; 572 572 struct rb_node *node, *next; 573 573 struct strlist *metriclist = NULL; 574 - const struct pmu_event *table; 574 + const struct pmu_events_table *table; 575 575 576 576 if (!metricgroups) { 577 577 metriclist = strlist__new(NULL, NULL); ··· 876 876 bool metric_no_group; 877 877 struct metric *root_metric; 878 878 const struct visited_metric *visited; 879 - const struct pmu_event *table; 879 + const struct pmu_events_table *table; 880 880 }; 881 881 882 882 static int add_metric(struct list_head *metric_list, ··· 885 885 bool metric_no_group, 886 886 struct metric *root_metric, 887 887 const struct visited_metric *visited, 888 - const struct pmu_event *table); 888 + const struct pmu_events_table *table); 889 889 890 890 /** 891 891 * resolve_metric - Locate metrics within the root metric and recursively add ··· 908 908 bool metric_no_group, 909 909 struct metric *root_metric, 910 910 const struct visited_metric *visited, 911 - const struct pmu_event *table) 911 + const struct pmu_events_table *table) 912 912 { 913 913 struct hashmap_entry *cur; 914 914 size_t bkt; ··· 986 986 int runtime, 987 987 struct metric *root_metric, 988 988 const struct visited_metric *visited, 989 - const struct pmu_event *table) 989 + const struct pmu_events_table *table) 990 990 { 991 991 const struct visited_metric *vm; 992 992 int ret; ··· 1077 1077 }; 1078 1078 1079 1079 static int metricgroup__find_metric_callback(const struct pmu_event *pe, 1080 - const struct pmu_event *table __maybe_unused, 1080 + const struct pmu_events_table *table __maybe_unused, 1081 1081 void *vdata) 1082 1082 { 1083 1083 struct metricgroup__find_metric_data *data = vdata; ··· 1090 1090 } 1091 1091 1092 1092 const struct pmu_event *metricgroup__find_metric(const char *metric, 1093 - const struct pmu_event *table) 1093 + const struct pmu_events_table *table) 1094 1094 { 1095 1095 struct metricgroup__find_metric_data data = { 1096 1096 .metric = metric, ··· 1108 1108 bool metric_no_group, 1109 1109 struct metric *root_metric, 1110 1110 const struct visited_metric *visited, 1111 - const struct pmu_event *table) 1111 + const struct pmu_events_table *table) 1112 1112 { 1113 1113 int ret = 0; 1114 1114 ··· 1136 1136 } 1137 1137 1138 1138 static int metricgroup__add_metric_sys_event_iter(const struct pmu_event *pe, 1139 - const struct pmu_event *table __maybe_unused, 1140 - void *data) 1139 + const struct pmu_events_table *table __maybe_unused, 1140 + void *data) 1141 1141 { 1142 1142 struct metricgroup_add_iter_data *d = data; 1143 1143 int ret; ··· 1193 1193 }; 1194 1194 1195 1195 static int metricgroup__add_metric_callback(const struct pmu_event *pe, 1196 - const struct pmu_event *table, 1196 + const struct pmu_events_table *table, 1197 1197 void *vdata) 1198 1198 { 1199 1199 struct metricgroup__add_metric_data *data = vdata; ··· 1227 1227 static int metricgroup__add_metric(const char *metric_name, const char *modifier, 1228 1228 bool metric_no_group, 1229 1229 struct list_head *metric_list, 1230 - const struct pmu_event *table) 1230 + const struct pmu_events_table *table) 1231 1231 { 1232 1232 LIST_HEAD(list); 1233 1233 int ret; ··· 1296 1296 */ 1297 1297 static int metricgroup__add_metric_list(const char *list, bool metric_no_group, 1298 1298 struct list_head *metric_list, 1299 - const struct pmu_event *table) 1299 + const struct pmu_events_table *table) 1300 1300 { 1301 1301 char *list_itr, *list_copy, *metric_name, *modifier; 1302 1302 int ret, count = 0; ··· 1504 1504 bool metric_no_merge, 1505 1505 struct perf_pmu *fake_pmu, 1506 1506 struct rblist *metric_events_list, 1507 - const struct pmu_event *table) 1507 + const struct pmu_events_table *table) 1508 1508 { 1509 1509 struct evlist *combined_evlist = NULL; 1510 1510 LIST_HEAD(metric_list); ··· 1650 1650 struct rblist *metric_events) 1651 1651 { 1652 1652 struct evlist *perf_evlist = *(struct evlist **)opt->value; 1653 - const struct pmu_event *table = pmu_events_table__find(); 1653 + const struct pmu_events_table *table = pmu_events_table__find(); 1654 1654 1655 1655 return parse_groups(perf_evlist, str, metric_no_group, 1656 1656 metric_no_merge, NULL, metric_events, table); 1657 1657 } 1658 1658 1659 1659 int metricgroup__parse_groups_test(struct evlist *evlist, 1660 - const struct pmu_event *table, 1660 + const struct pmu_events_table *table, 1661 1661 const char *str, 1662 1662 bool metric_no_group, 1663 1663 bool metric_no_merge, ··· 1668 1668 } 1669 1669 1670 1670 static int metricgroup__has_metric_callback(const struct pmu_event *pe, 1671 - const struct pmu_event *table __maybe_unused, 1671 + const struct pmu_events_table *table __maybe_unused, 1672 1672 void *vdata) 1673 1673 { 1674 1674 const char *metric = vdata; ··· 1684 1684 1685 1685 bool metricgroup__has_metric(const char *metric) 1686 1686 { 1687 - const struct pmu_event *table = pmu_events_table__find(); 1687 + const struct pmu_events_table *table = pmu_events_table__find(); 1688 1688 1689 1689 if (!table) 1690 1690 return false;
+2 -3
tools/perf/util/metricgroup.h
··· 11 11 struct evsel; 12 12 struct option; 13 13 struct rblist; 14 - struct pmu_events_map; 15 14 struct cgroup; 16 15 17 16 /** ··· 70 71 bool metric_no_merge, 71 72 struct rblist *metric_events); 72 73 const struct pmu_event *metricgroup__find_metric(const char *metric, 73 - const struct pmu_event *table); 74 + const struct pmu_events_table *table); 74 75 int metricgroup__parse_groups_test(struct evlist *evlist, 75 - const struct pmu_event *table, 76 + const struct pmu_events_table *table, 76 77 const char *str, 77 78 bool metric_no_group, 78 79 bool metric_no_merge,
+5 -5
tools/perf/util/pmu.c
··· 710 710 return cpuid; 711 711 } 712 712 713 - __weak const struct pmu_event *pmu_events_table__find(void) 713 + __weak const struct pmu_events_table *pmu_events_table__find(void) 714 714 { 715 715 return perf_pmu__find_table(NULL); 716 716 } ··· 799 799 }; 800 800 801 801 static int pmu_add_cpu_aliases_map_callback(const struct pmu_event *pe, 802 - const struct pmu_event *table __maybe_unused, 802 + const struct pmu_events_table *table __maybe_unused, 803 803 void *vdata) 804 804 { 805 805 struct pmu_add_cpu_aliases_map_data *data = vdata; ··· 827 827 * as aliases. 828 828 */ 829 829 void pmu_add_cpu_aliases_table(struct list_head *head, struct perf_pmu *pmu, 830 - const struct pmu_event *table) 830 + const struct pmu_events_table *table) 831 831 { 832 832 struct pmu_add_cpu_aliases_map_data data = { 833 833 .head = head, ··· 841 841 842 842 static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) 843 843 { 844 - const struct pmu_event *table; 844 + const struct pmu_events_table *table; 845 845 846 846 table = perf_pmu__find_table(pmu); 847 847 if (!table) ··· 856 856 }; 857 857 858 858 static int pmu_add_sys_aliases_iter_fn(const struct pmu_event *pe, 859 - const struct pmu_event *table __maybe_unused, 859 + const struct pmu_events_table *table __maybe_unused, 860 860 void *data) 861 861 { 862 862 struct pmu_sys_event_iter_data *idata = data;
+2 -2
tools/perf/util/pmu.h
··· 126 126 127 127 struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu); 128 128 void pmu_add_cpu_aliases_table(struct list_head *head, struct perf_pmu *pmu, 129 - const struct pmu_event *table); 129 + const struct pmu_events_table *table); 130 130 131 131 char *perf_pmu__getcpuid(struct perf_pmu *pmu); 132 - const struct pmu_event *pmu_events_table__find(void); 132 + const struct pmu_events_table *pmu_events_table__find(void); 133 133 bool pmu_uncore_alias_match(const char *pmu_name, const char *name); 134 134 void perf_pmu_free_alias(struct perf_pmu_alias *alias); 135 135
+3 -3
tools/perf/util/s390-sample-raw.c
··· 135 135 }; 136 136 137 137 static int get_counter_name_callback(const struct pmu_event *evp, 138 - const struct pmu_event *table __maybe_unused, 138 + const struct pmu_events_table *table __maybe_unused, 139 139 void *vdata) 140 140 { 141 141 struct get_counter_name_data *data = vdata; ··· 157 157 * the name of this counter. 158 158 * If no match is found a NULL pointer is returned. 159 159 */ 160 - static const char *get_counter_name(int set, int nr, const struct pmu_event *table) 160 + static const char *get_counter_name(int set, int nr, const struct pmu_events_table *table) 161 161 { 162 162 struct get_counter_name_data data = { 163 163 .wanted = get_counterset_start(set) + nr, ··· 177 177 unsigned char *buf = sample->raw_data; 178 178 const char *color = PERF_COLOR_BLUE; 179 179 struct cf_ctrset_entry *cep, ce; 180 - const struct pmu_event *table; 180 + const struct pmu_events_table *table; 181 181 u64 *p; 182 182 183 183 table = pmu_events_table__find();