From: Yang Jihong <yangjihong1@xxxxxxxxxx> commit f6ff1c760431be34e4daaa44f242be911becd998 upstream. For dummy events that keep tracking, we may need to modify its cpu_maps. For example, change the cpu_maps to record sideband events for all CPUS. Add perf_evlist__go_system_wide() helper to support this scenario. Signed-off-by: Yang Jihong <yangjihong1@xxxxxxxxxx> Acked-by: Adrian Hunter <adrian.hunter@xxxxxxxxx> Tested-by: Ravi Bangoria <ravi.bangoria@xxxxxxx> Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx> Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx> Cc: Anshuman Khandual <anshuman.khandual@xxxxxxx> Cc: Ian Rogers <irogers@xxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: James Clark <james.clark@xxxxxxx> Cc: Jiri Olsa <jolsa@xxxxxxxxxx> Cc: Kan Liang <kan.liang@xxxxxxxxxxxxxxx> Cc: Mark Rutland <mark.rutland@xxxxxxx> Cc: Namhyung Kim <namhyung@xxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Thomas Richter <tmricht@xxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20230904023340.12707-2-yangjihong1@xxxxxxxxxx Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- tools/lib/perf/evlist.c | 9 +++++++++ tools/lib/perf/include/internal/evlist.h | 2 ++ 2 files changed, 11 insertions(+) --- a/tools/lib/perf/evlist.c +++ b/tools/lib/perf/evlist.c @@ -744,3 +744,12 @@ int perf_evlist__nr_groups(struct perf_e } return nr_groups; } + +void perf_evlist__go_system_wide(struct perf_evlist *evlist, struct perf_evsel *evsel) +{ + if (!evsel->system_wide) { + evsel->system_wide = true; + if (evlist->needs_map_propagation) + __perf_evlist__propagate_maps(evlist, evsel); + } +} --- a/tools/lib/perf/include/internal/evlist.h +++ b/tools/lib/perf/include/internal/evlist.h @@ -135,4 +135,6 @@ int perf_evlist__id_add_fd(struct perf_e void perf_evlist__reset_id_hash(struct perf_evlist *evlist); void __perf_evlist__set_leader(struct list_head *list, struct perf_evsel *leader); + +void perf_evlist__go_system_wide(struct perf_evlist *evlist, struct perf_evsel *evsel); #endif /* __LIBPERF_INTERNAL_EVLIST_H */ Patches currently in stable-queue which might be from yangjihong1@xxxxxxxxxx are queue-6.6/perf-evlist-add-evlist__findnew_tracking_event-helpe.patch queue-6.6/perf-util-add-a-function-for-replacing-characters-in-a-string.patch queue-6.6/perf-evlist-add-perf_evlist__go_system_wide-helper.patch queue-6.6/perf-record-lazy-load-kernel-symbols.patch queue-6.6/perf-maps-move-symbol-maps-functions-to-maps.c.patch queue-6.6/perf-record-move-setting-tracking-events-before-reco.patch queue-6.6/perf-tools-add-use-pmu-reverse-lookup-from-config-to.patch queue-6.6/perf-test-add-a-test-for-strcmp_cpuid_str-expression.patch queue-6.6/perf-tools-use-pmus-to-describe-type-from-attribute.patch queue-6.6/perf-machine-thread-remove-exited-threads-by-default.patch