diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-12-11 16:04:10 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-12-11 16:04:10 -0500 |
commit | e09b18d4907992d3d615b215c1abf585721b2810 (patch) | |
tree | b072fff64a3790e7862ae6f9a8681fffaa28c75d /tools | |
parent | 956fa57106d1ad3ffbe73f4534b9f3b3bc92dd6c (diff) |
perf trace: Provide a better explanation when mmap fails
If we ask for a mmap lenght than the max configured via the relevant
sysctl, provide a better warning, instead of just expanding the EPERM
returned:
[acme@ssdandy ~]$ trace -m 256 -e nanosleep sleep 2
Error: Operation not permitted.
Hint: Check /proc/sys/kernel/perf_event_mlock_kb (516 kB) setting.
Hint: Tried using 1028 kB.
Hint: Try using a bigger -m/--mmap-pages value.
[acme@ssdandy ~]$ trace -m 128 -e nanosleep sleep 2
2001.280 (2000.403 ms): nanosleep(rqtp: 0x7fff89a8a7f0) = 0
[acme@ssdandy ~]$
An upcoming patch will autotune the request for non-root users when -m
is not used.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-cdvxfz2gycetbkopm9sna1qp@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-trace.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 83a4835c8118..327541e43c7f 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -2045,7 +2045,6 @@ static int trace__run(struct trace *trace, int argc, const char **argv) | |||
2045 | unsigned long before; | 2045 | unsigned long before; |
2046 | const bool forks = argc > 0; | 2046 | const bool forks = argc > 0; |
2047 | bool draining = false; | 2047 | bool draining = false; |
2048 | char sbuf[STRERR_BUFSIZE]; | ||
2049 | 2048 | ||
2050 | trace->live = true; | 2049 | trace->live = true; |
2051 | 2050 | ||
@@ -2106,11 +2105,8 @@ static int trace__run(struct trace *trace, int argc, const char **argv) | |||
2106 | goto out_error_open; | 2105 | goto out_error_open; |
2107 | 2106 | ||
2108 | err = perf_evlist__mmap(evlist, trace->opts.mmap_pages, false); | 2107 | err = perf_evlist__mmap(evlist, trace->opts.mmap_pages, false); |
2109 | if (err < 0) { | 2108 | if (err < 0) |
2110 | fprintf(trace->output, "Couldn't mmap the events: %s\n", | 2109 | goto out_error_mmap; |
2111 | strerror_r(errno, sbuf, sizeof(sbuf))); | ||
2112 | goto out_delete_evlist; | ||
2113 | } | ||
2114 | 2110 | ||
2115 | perf_evlist__enable(evlist); | 2111 | perf_evlist__enable(evlist); |
2116 | 2112 | ||
@@ -2210,6 +2206,10 @@ out_error_tp: | |||
2210 | perf_evlist__strerror_tp(evlist, errno, errbuf, sizeof(errbuf)); | 2206 | perf_evlist__strerror_tp(evlist, errno, errbuf, sizeof(errbuf)); |
2211 | goto out_error; | 2207 | goto out_error; |
2212 | 2208 | ||
2209 | out_error_mmap: | ||
2210 | perf_evlist__strerror_mmap(evlist, errno, errbuf, sizeof(errbuf)); | ||
2211 | goto out_error; | ||
2212 | |||
2213 | out_error_open: | 2213 | out_error_open: |
2214 | perf_evlist__strerror_open(evlist, errno, errbuf, sizeof(errbuf)); | 2214 | perf_evlist__strerror_open(evlist, errno, errbuf, sizeof(errbuf)); |
2215 | 2215 | ||