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

perf list: Fix topic and pmu_name argument order

Fix function definitions to match header file declaration. Fix two
callers to pass the arguments in the right order.

On Intel Tigerlake, before:
```
$ perf list -j|grep "\"Topic\""|sort|uniq
"Topic": "cache",
"Topic": "cpu",
"Topic": "floating point",
"Topic": "frontend",
"Topic": "memory",
"Topic": "other",
"Topic": "pfm icl",
"Topic": "pfm ix86arch",
"Topic": "pfm perf_raw",
"Topic": "pipeline",
"Topic": "tool",
"Topic": "uncore interconnect",
"Topic": "uncore memory",
"Topic": "uncore other",
"Topic": "virtual memory",
$ perf list -j|grep "\"Unit\""|sort|uniq
"Unit": "cache",
"Unit": "cpu",
"Unit": "cstate_core",
"Unit": "cstate_pkg",
"Unit": "i915",
"Unit": "icl",
"Unit": "intel_bts",
"Unit": "intel_pt",
"Unit": "ix86arch",
"Unit": "msr",
"Unit": "perf_raw",
"Unit": "power",
"Unit": "tool",
"Unit": "uncore_arb",
"Unit": "uncore_clock",
"Unit": "uncore_imc_free_running_0",
"Unit": "uncore_imc_free_running_1",
```

After:
```
$ perf list -j|grep "\"Topic\""|sort|uniq
"Topic": "cache",
"Topic": "floating point",
"Topic": "frontend",
"Topic": "memory",
"Topic": "other",
"Topic": "pfm icl",
"Topic": "pfm ix86arch",
"Topic": "pfm perf_raw",
"Topic": "pipeline",
"Topic": "tool",
"Topic": "uncore interconnect",
"Topic": "uncore memory",
"Topic": "uncore other",
"Topic": "virtual memory",
$ perf list -j|grep "\"Unit\""|sort|uniq
"Unit": "cpu",
"Unit": "cstate_core",
"Unit": "cstate_pkg",
"Unit": "i915",
"Unit": "icl",
"Unit": "intel_bts",
"Unit": "intel_pt",
"Unit": "ix86arch",
"Unit": "msr",
"Unit": "perf_raw",
"Unit": "power",
"Unit": "tool",
"Unit": "uncore_arb",
"Unit": "uncore_clock",
"Unit": "uncore_imc_free_running_0",
"Unit": "uncore_imc_free_running_1",
```

Fixes: e5c6109f4813246a ("perf list: Reorganize to use callbacks to allow honouring command line options")
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Jean-Philippe Romain <jean-philippe.romain@foss.st.com>
Tested-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Junhao He <hejunhao3@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20241109025801.560378-1-irogers@google.com
[ I fixed the two callers and added it to Jean-Phillippe's original change. ]
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jean-Philippe Romain and committed by
Arnaldo Carvalho de Melo
d99b3125 463c2031

+5 -5
+2 -2
tools/perf/builtin-list.c
··· 113 113 } 114 114 } 115 115 116 - static void default_print_event(void *ps, const char *pmu_name, const char *topic, 116 + static void default_print_event(void *ps, const char *topic, const char *pmu_name, 117 117 const char *event_name, const char *event_alias, 118 118 const char *scale_unit __maybe_unused, 119 119 bool deprecated, const char *event_type_desc, ··· 354 354 fputs(buf->buf, fp); 355 355 } 356 356 357 - static void json_print_event(void *ps, const char *pmu_name, const char *topic, 357 + static void json_print_event(void *ps, const char *topic, const char *pmu_name, 358 358 const char *event_name, const char *event_alias, 359 359 const char *scale_unit, 360 360 bool deprecated, const char *event_type_desc,
+2 -2
tools/perf/util/pfm.c
··· 233 233 } 234 234 235 235 if (is_libpfm_event_supported(name, cpus, threads)) { 236 - print_cb->print_event(print_state, pinfo->name, topic, 236 + print_cb->print_event(print_state, topic, pinfo->name, 237 237 name, info->equiv, 238 238 /*scale_unit=*/NULL, 239 239 /*deprecated=*/NULL, "PFM event", ··· 267 267 continue; 268 268 269 269 print_cb->print_event(print_state, 270 - pinfo->name, 271 270 topic, 271 + pinfo->name, 272 272 name, /*alias=*/NULL, 273 273 /*scale_unit=*/NULL, 274 274 /*deprecated=*/NULL, "PFM event",
+1 -1
tools/perf/util/pmus.c
··· 503 503 goto free; 504 504 505 505 print_cb->print_event(print_state, 506 - aliases[j].pmu_name, 507 506 aliases[j].topic, 507 + aliases[j].pmu_name, 508 508 aliases[j].name, 509 509 aliases[j].alias, 510 510 aliases[j].scale_unit,