Skip to content

Commit bc105a8

Browse files
captain5050acmel
authored andcommitted
Revert "perf tool_pmu: More accurately set the cpus for tool events"
This reverts commit d8d8a0b. 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>
1 parent 1f12fb1 commit bc105a8

3 files changed

Lines changed: 2 additions & 27 deletions

File tree

tools/perf/util/parse-events.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include "util/event.h"
3131
#include "util/bpf-filter.h"
3232
#include "util/stat.h"
33-
#include "util/tool_pmu.h"
3433
#include "util/util.h"
3534
#include "tracepoint.h"
3635
#include <api/fs/tracing_path.h>
@@ -230,12 +229,8 @@ __add_event(struct list_head *list, int *idx,
230229
if (pmu) {
231230
is_pmu_core = pmu->is_core;
232231
pmu_cpus = perf_cpu_map__get(pmu->cpus);
233-
if (perf_cpu_map__is_empty(pmu_cpus)) {
234-
if (perf_pmu__is_tool(pmu))
235-
pmu_cpus = tool_pmu__cpus(attr);
236-
else
237-
pmu_cpus = cpu_map__online();
238-
}
232+
if (perf_cpu_map__is_empty(pmu_cpus))
233+
pmu_cpus = cpu_map__online();
239234
} else {
240235
is_pmu_core = (attr->type == PERF_TYPE_HARDWARE ||
241236
attr->type == PERF_TYPE_HW_CACHE);

tools/perf/util/tool_pmu.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "cgroup.h"
33
#include "counts.h"
44
#include "cputopo.h"
5-
#include "debug.h"
65
#include "evsel.h"
76
#include "pmu.h"
87
#include "print-events.h"
@@ -14,7 +13,6 @@
1413
#include <api/fs/fs.h>
1514
#include <api/io.h>
1615
#include <internal/threadmap.h>
17-
#include <perf/cpumap.h>
1816
#include <perf/threadmap.h>
1917
#include <fcntl.h>
2018
#include <strings.h>
@@ -111,23 +109,6 @@ const char *evsel__tool_pmu_event_name(const struct evsel *evsel)
111109
return tool_pmu__event_to_str(evsel->core.attr.config);
112110
}
113111

114-
struct perf_cpu_map *tool_pmu__cpus(struct perf_event_attr *attr)
115-
{
116-
static struct perf_cpu_map *cpu0_map;
117-
enum tool_pmu_event event = (enum tool_pmu_event)attr->config;
118-
119-
if (event <= TOOL_PMU__EVENT_NONE || event >= TOOL_PMU__EVENT_MAX) {
120-
pr_err("Invalid tool PMU event config %llx\n", attr->config);
121-
return NULL;
122-
}
123-
if (event == TOOL_PMU__EVENT_USER_TIME || event == TOOL_PMU__EVENT_SYSTEM_TIME)
124-
return cpu_map__online();
125-
126-
if (!cpu0_map)
127-
cpu0_map = perf_cpu_map__new_int(0);
128-
return perf_cpu_map__get(cpu0_map);
129-
}
130-
131112
static bool read_until_char(struct io *io, char e)
132113
{
133114
int c;

tools/perf/util/tool_pmu.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ bool tool_pmu__read_event(enum tool_pmu_event ev,
4646
u64 tool_pmu__cpu_slots_per_cycle(void);
4747

4848
bool perf_pmu__is_tool(const struct perf_pmu *pmu);
49-
struct perf_cpu_map *tool_pmu__cpus(struct perf_event_attr *attr);
5049

5150
bool evsel__is_tool(const struct evsel *evsel);
5251
enum tool_pmu_event evsel__tool_event(const struct evsel *evsel);

0 commit comments

Comments
 (0)