| .. | .. |
|---|
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
|---|
| 2 | 2 | #include <errno.h> |
|---|
| 3 | 3 | #include <sched.h> |
|---|
| 4 | | -#include "util.h" |
|---|
| 5 | | -#include "../perf.h" |
|---|
| 4 | +#include "util.h" // for sched_getcpu() |
|---|
| 5 | +#include "../perf-sys.h" |
|---|
| 6 | 6 | #include "cloexec.h" |
|---|
| 7 | +#include "event.h" |
|---|
| 7 | 8 | #include "asm/bug.h" |
|---|
| 8 | 9 | #include "debug.h" |
|---|
| 9 | 10 | #include <unistd.h> |
|---|
| 10 | | -#include <asm/unistd.h> |
|---|
| 11 | 11 | #include <sys/syscall.h> |
|---|
| 12 | +#include <linux/string.h> |
|---|
| 12 | 13 | |
|---|
| 13 | 14 | static unsigned long flag = PERF_FLAG_FD_CLOEXEC; |
|---|
| 14 | 15 | |
|---|
| .. | .. |
|---|
| 27 | 28 | |
|---|
| 28 | 29 | static int perf_flag_probe(void) |
|---|
| 29 | 30 | { |
|---|
| 30 | | - /* use 'safest' configuration as used in perf_evsel__fallback() */ |
|---|
| 31 | + /* use 'safest' configuration as used in evsel__fallback() */ |
|---|
| 31 | 32 | struct perf_event_attr attr = { |
|---|
| 32 | 33 | .type = PERF_TYPE_SOFTWARE, |
|---|
| 33 | 34 | .config = PERF_COUNT_SW_CPU_CLOCK, |
|---|
| .. | .. |
|---|
| 64 | 65 | return 1; |
|---|
| 65 | 66 | } |
|---|
| 66 | 67 | |
|---|
| 67 | | - WARN_ONCE(err != EINVAL && err != EBUSY, |
|---|
| 68 | + WARN_ONCE(err != EINVAL && err != EBUSY && err != EACCES, |
|---|
| 68 | 69 | "perf_event_open(..., PERF_FLAG_FD_CLOEXEC) failed with unexpected error %d (%s)\n", |
|---|
| 69 | 70 | err, str_error_r(err, sbuf, sizeof(sbuf))); |
|---|
| 70 | 71 | |
|---|
| .. | .. |
|---|
| 82 | 83 | if (fd >= 0) |
|---|
| 83 | 84 | close(fd); |
|---|
| 84 | 85 | |
|---|
| 85 | | - if (WARN_ONCE(fd < 0 && err != EBUSY, |
|---|
| 86 | + if (WARN_ONCE(fd < 0 && err != EBUSY && err != EACCES, |
|---|
| 86 | 87 | "perf_event_open(..., 0) failed unexpectedly with error %d (%s)\n", |
|---|
| 87 | 88 | err, str_error_r(err, sbuf, sizeof(sbuf)))) |
|---|
| 88 | 89 | return -1; |
|---|