Skip to content

Commit b4c658d

Browse files
captain5050namhyung
authored andcommitted
perf target: Remove uid from target
Gathering threads with a uid by scanning /proc is inherently racy leading to perf_event_open failures that quit perf. All users of the functionality now use BPF filters, so remove uid and uid_str from target. Signed-off-by: Ian Rogers <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent 278538d commit b4c658d

13 files changed

+6
-73
lines changed

tools/perf/builtin-ftrace.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,6 @@ int cmd_ftrace(int argc, const char **argv)
16631663
int (*cmd_func)(struct perf_ftrace *) = NULL;
16641664
struct perf_ftrace ftrace = {
16651665
.tracer = DEFAULT_TRACER,
1666-
.target = { .uid = UINT_MAX, },
16671666
};
16681667
const struct option common_options[] = {
16691668
OPT_STRING('p', "pid", &ftrace.target.pid, "pid",

tools/perf/builtin-kvm.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,8 +1871,6 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
18711871
kvm->opts.user_interval = 1;
18721872
kvm->opts.mmap_pages = 512;
18731873
kvm->opts.target.uses_mmap = false;
1874-
kvm->opts.target.uid_str = NULL;
1875-
kvm->opts.target.uid = UINT_MAX;
18761874

18771875
symbol__init(NULL);
18781876
disable_buildid_cache();

tools/perf/builtin-stat.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@ static struct parse_events_option_args parse_events_option_args = {
108108

109109
static bool all_counters_use_bpf = true;
110110

111-
static struct target target = {
112-
.uid = UINT_MAX,
113-
};
111+
static struct target target;
114112

115113
static volatile sig_atomic_t child_pid = -1;
116114
static int detailed_run = 0;

tools/perf/builtin-trace.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5399,7 +5399,6 @@ int cmd_trace(int argc, const char **argv)
53995399
struct trace trace = {
54005400
.opts = {
54015401
.target = {
5402-
.uid = UINT_MAX,
54035402
.uses_mmap = true,
54045403
},
54055404
.user_freq = UINT_MAX,

tools/perf/tests/backward-ring-buffer.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ static int test__backward_ring_buffer(struct test_suite *test __maybe_unused, in
9191
struct parse_events_error parse_error;
9292
struct record_opts opts = {
9393
.target = {
94-
.uid = UINT_MAX,
9594
.uses_mmap = true,
9695
},
9796
.freq = 0,

tools/perf/tests/event-times.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
static int attach__enable_on_exec(struct evlist *evlist)
1818
{
1919
struct evsel *evsel = evlist__last(evlist);
20-
struct target target = {
21-
.uid = UINT_MAX,
22-
};
20+
struct target target = {};
2321
const char *argv[] = { "true", NULL, };
2422
char sbuf[STRERR_BUFSIZE];
2523
int err;

tools/perf/tests/openat-syscall-tp-fields.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ static int test__syscall_openat_tp_fields(struct test_suite *test __maybe_unused
2828
{
2929
struct record_opts opts = {
3030
.target = {
31-
.uid = UINT_MAX,
3231
.uses_mmap = true,
3332
},
3433
.no_buffering = true,

tools/perf/tests/perf-record.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ static int test__PERF_RECORD(struct test_suite *test __maybe_unused, int subtest
4545
{
4646
struct record_opts opts = {
4747
.target = {
48-
.uid = UINT_MAX,
4948
.uses_mmap = true,
5049
},
5150
.no_buffering = true,

tools/perf/tests/task-exit.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ static int test__task_exit(struct test_suite *test __maybe_unused, int subtest _
4646
struct evsel *evsel;
4747
struct evlist *evlist;
4848
struct target target = {
49-
.uid = UINT_MAX,
5049
.uses_mmap = true,
5150
};
5251
const char *argv[] = { "true", NULL };

tools/perf/util/bpf-filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ int perf_bpf_filter__prepare(struct evsel *evsel, struct target *target)
450450
struct bpf_program *prog;
451451
struct bpf_link *link;
452452
struct perf_bpf_filter_entry *entry;
453-
bool needs_idx_hash = !target__has_cpu(target) && !target->uid_str;
453+
bool needs_idx_hash = !target__has_cpu(target);
454454

455455
entry = calloc(MAX_FILTERS, sizeof(*entry));
456456
if (entry == NULL)

0 commit comments

Comments
 (0)