diff options
-rw-r--r-- | tools/perf/util/evsel.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index b2365a63db45..fd61ebd77c26 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -1474,7 +1474,7 @@ retry_sample_id: | |||
1474 | for (cpu = 0; cpu < cpus->nr; cpu++) { | 1474 | for (cpu = 0; cpu < cpus->nr; cpu++) { |
1475 | 1475 | ||
1476 | for (thread = 0; thread < nthreads; thread++) { | 1476 | for (thread = 0; thread < nthreads; thread++) { |
1477 | int group_fd; | 1477 | int fd, group_fd; |
1478 | 1478 | ||
1479 | if (!evsel->cgrp && !evsel->system_wide) | 1479 | if (!evsel->cgrp && !evsel->system_wide) |
1480 | pid = thread_map__pid(threads, thread); | 1480 | pid = thread_map__pid(threads, thread); |
@@ -1484,21 +1484,22 @@ retry_open: | |||
1484 | pr_debug2("sys_perf_event_open: pid %d cpu %d group_fd %d flags %#lx", | 1484 | pr_debug2("sys_perf_event_open: pid %d cpu %d group_fd %d flags %#lx", |
1485 | pid, cpus->map[cpu], group_fd, flags); | 1485 | pid, cpus->map[cpu], group_fd, flags); |
1486 | 1486 | ||
1487 | FD(evsel, cpu, thread) = sys_perf_event_open(&evsel->attr, | 1487 | fd = sys_perf_event_open(&evsel->attr, pid, cpus->map[cpu], |
1488 | pid, | 1488 | group_fd, flags); |
1489 | cpus->map[cpu], | 1489 | |
1490 | group_fd, flags); | 1490 | FD(evsel, cpu, thread) = fd; |
1491 | if (FD(evsel, cpu, thread) < 0) { | 1491 | |
1492 | if (fd < 0) { | ||
1492 | err = -errno; | 1493 | err = -errno; |
1493 | pr_debug2("\nsys_perf_event_open failed, error %d\n", | 1494 | pr_debug2("\nsys_perf_event_open failed, error %d\n", |
1494 | err); | 1495 | err); |
1495 | goto try_fallback; | 1496 | goto try_fallback; |
1496 | } | 1497 | } |
1497 | 1498 | ||
1498 | pr_debug2(" = %d\n", FD(evsel, cpu, thread)); | 1499 | pr_debug2(" = %d\n", fd); |
1499 | 1500 | ||
1500 | if (evsel->bpf_fd >= 0) { | 1501 | if (evsel->bpf_fd >= 0) { |
1501 | int evt_fd = FD(evsel, cpu, thread); | 1502 | int evt_fd = fd; |
1502 | int bpf_fd = evsel->bpf_fd; | 1503 | int bpf_fd = evsel->bpf_fd; |
1503 | 1504 | ||
1504 | err = ioctl(evt_fd, | 1505 | err = ioctl(evt_fd, |