diff options
Diffstat (limited to 'tools/perf/util/evlist.c')
-rw-r--r-- | tools/perf/util/evlist.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index d852cefa20de..45da8d186b49 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "evlist.h" | 12 | #include "evlist.h" |
13 | #include "evsel.h" | 13 | #include "evsel.h" |
14 | #include "util.h" | 14 | #include "util.h" |
15 | #include "debug.h" | ||
15 | 16 | ||
16 | #include <sys/mman.h> | 17 | #include <sys/mman.h> |
17 | 18 | ||
@@ -250,15 +251,19 @@ int perf_evlist__alloc_mmap(struct perf_evlist *evlist) | |||
250 | return evlist->mmap != NULL ? 0 : -ENOMEM; | 251 | return evlist->mmap != NULL ? 0 : -ENOMEM; |
251 | } | 252 | } |
252 | 253 | ||
253 | static int __perf_evlist__mmap(struct perf_evlist *evlist, int cpu, int prot, | 254 | static int __perf_evlist__mmap(struct perf_evlist *evlist, struct perf_evsel *evsel, |
254 | int mask, int fd) | 255 | int cpu, int prot, int mask, int fd) |
255 | { | 256 | { |
256 | evlist->mmap[cpu].prev = 0; | 257 | evlist->mmap[cpu].prev = 0; |
257 | evlist->mmap[cpu].mask = mask; | 258 | evlist->mmap[cpu].mask = mask; |
258 | evlist->mmap[cpu].base = mmap(NULL, evlist->mmap_len, prot, | 259 | evlist->mmap[cpu].base = mmap(NULL, evlist->mmap_len, prot, |
259 | MAP_SHARED, fd, 0); | 260 | MAP_SHARED, fd, 0); |
260 | if (evlist->mmap[cpu].base == MAP_FAILED) | 261 | if (evlist->mmap[cpu].base == MAP_FAILED) { |
262 | if (evlist->cpus->map[cpu] == -1 && evsel->attr.inherit) | ||
263 | ui__warning("Inherit is not allowed on per-task " | ||
264 | "events using mmap.\n"); | ||
261 | return -1; | 265 | return -1; |
266 | } | ||
262 | 267 | ||
263 | perf_evlist__add_pollfd(evlist, fd); | 268 | perf_evlist__add_pollfd(evlist, fd); |
264 | return 0; | 269 | return 0; |
@@ -312,7 +317,8 @@ int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite) | |||
312 | if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, | 317 | if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, |
313 | FD(first_evsel, cpu, 0)) != 0) | 318 | FD(first_evsel, cpu, 0)) != 0) |
314 | goto out_unmap; | 319 | goto out_unmap; |
315 | } else if (__perf_evlist__mmap(evlist, cpu, prot, mask, fd) < 0) | 320 | } else if (__perf_evlist__mmap(evlist, evsel, cpu, |
321 | prot, mask, fd) < 0) | ||
316 | goto out_unmap; | 322 | goto out_unmap; |
317 | 323 | ||
318 | if ((evsel->attr.read_format & PERF_FORMAT_ID) && | 324 | if ((evsel->attr.read_format & PERF_FORMAT_ID) && |