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

Configure Feed

Select the types of activity you want to include in your feed.

Revert "perf tool_pmu: More accurately set the cpus for tool events"

This reverts commit d8d8a0b3603a9a8fa207cf9e4f292e81dc5d1008.

The setting of a user CPU map can cause an empty intersection when
combined with CPU 0 and the event removed. This later triggers a segv in
the stat-shadow logic. Let's put back a full online CPU map for now by
reverting this patch.

Closes: https://lore.kernel.org/linux-perf-users/cgja46br2smmznxs7kbeabs6zgv3b4olfqgh2fdp5mxk2yom4v@w6jjgov6hdi6/
Reported-by: Andres Freund <andres@anarazel.de>
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: Dapeng Mi <dapeng1.mi@linux.intel.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
bc105a89 1f12fb13

+2 -27
+2 -7
tools/perf/util/parse-events.c
··· 30 30 #include "util/event.h" 31 31 #include "util/bpf-filter.h" 32 32 #include "util/stat.h" 33 - #include "util/tool_pmu.h" 34 33 #include "util/util.h" 35 34 #include "tracepoint.h" 36 35 #include <api/fs/tracing_path.h> ··· 229 230 if (pmu) { 230 231 is_pmu_core = pmu->is_core; 231 232 pmu_cpus = perf_cpu_map__get(pmu->cpus); 232 - if (perf_cpu_map__is_empty(pmu_cpus)) { 233 - if (perf_pmu__is_tool(pmu)) 234 - pmu_cpus = tool_pmu__cpus(attr); 235 - else 236 - pmu_cpus = cpu_map__online(); 237 - } 233 + if (perf_cpu_map__is_empty(pmu_cpus)) 234 + pmu_cpus = cpu_map__online(); 238 235 } else { 239 236 is_pmu_core = (attr->type == PERF_TYPE_HARDWARE || 240 237 attr->type == PERF_TYPE_HW_CACHE);
-19
tools/perf/util/tool_pmu.c
··· 2 2 #include "cgroup.h" 3 3 #include "counts.h" 4 4 #include "cputopo.h" 5 - #include "debug.h" 6 5 #include "evsel.h" 7 6 #include "pmu.h" 8 7 #include "print-events.h" ··· 13 14 #include <api/fs/fs.h> 14 15 #include <api/io.h> 15 16 #include <internal/threadmap.h> 16 - #include <perf/cpumap.h> 17 17 #include <perf/threadmap.h> 18 18 #include <fcntl.h> 19 19 #include <strings.h> ··· 107 109 const char *evsel__tool_pmu_event_name(const struct evsel *evsel) 108 110 { 109 111 return tool_pmu__event_to_str(evsel->core.attr.config); 110 - } 111 - 112 - struct perf_cpu_map *tool_pmu__cpus(struct perf_event_attr *attr) 113 - { 114 - static struct perf_cpu_map *cpu0_map; 115 - enum tool_pmu_event event = (enum tool_pmu_event)attr->config; 116 - 117 - if (event <= TOOL_PMU__EVENT_NONE || event >= TOOL_PMU__EVENT_MAX) { 118 - pr_err("Invalid tool PMU event config %llx\n", attr->config); 119 - return NULL; 120 - } 121 - if (event == TOOL_PMU__EVENT_USER_TIME || event == TOOL_PMU__EVENT_SYSTEM_TIME) 122 - return cpu_map__online(); 123 - 124 - if (!cpu0_map) 125 - cpu0_map = perf_cpu_map__new_int(0); 126 - return perf_cpu_map__get(cpu0_map); 127 112 } 128 113 129 114 static bool read_until_char(struct io *io, char e)
-1
tools/perf/util/tool_pmu.h
··· 46 46 u64 tool_pmu__cpu_slots_per_cycle(void); 47 47 48 48 bool perf_pmu__is_tool(const struct perf_pmu *pmu); 49 - struct perf_cpu_map *tool_pmu__cpus(struct perf_event_attr *attr); 50 49 51 50 bool evsel__is_tool(const struct evsel *evsel); 52 51 enum tool_pmu_event evsel__tool_event(const struct evsel *evsel);