diff options
author | James Clark <james.clark@linaro.org> | 2025-02-26 10:41:01 +0000 |
---|---|---|
committer | Namhyung Kim <namhyung@kernel.org> | 2025-02-26 16:23:47 -0800 |
commit | c9d699e10fa6c0cdabcddcf991e7ff42af6b2503 (patch) | |
tree | de2b32ec5b93be3e305b5feb4698ceb7cd701fb1 /tools/perf/util/trace-event-scripting.c | |
parent | 72c6f57a4193f2eadceb52261315438719c4c1ad (diff) |
perf pmu: Don't double count common sysfs and json events
After pmu_add_cpu_aliases() is called, perf_pmu__num_events() returns an
incorrect value that double counts common events and doesn't match the
actual count of events in the alias list. This is because after
'cpu_aliases_added == true', the number of events returned is
'sysfs_aliases + cpu_json_aliases'. But when adding 'case
EVENT_SRC_SYSFS' events, 'sysfs_aliases' and 'cpu_json_aliases' are both
incremented together, failing to account that these ones overlap and
only add a single item to the list. Fix it by adding another counter for
overlapping events which doesn't influence 'cpu_json_aliases'.
There doesn't seem to be a current issue because it's used in perf list
before pmu_add_cpu_aliases() so the correct value is returned. Other
uses in tests may also miss it for other reasons like only looking at
uncore events. However it's marked as a fixes commit in case any new fix
with new uses of perf_pmu__num_events() is backported.
Fixes: d9c5f5f94c2d ("perf pmu: Count sys and cpuid JSON events separately")
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://lore.kernel.org/r/20250226104111.564443-3-james.clark@linaro.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
0 files changed, 0 insertions, 0 deletions