perf evsel: Inform how to make a sysctl setting permanent
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: d6195a6a2c247515d5832debb51c03a74dc3f8f6 Gitweb: http://git.kernel.org/tip/d6195a6a2c247515d5832debb51c03a74dc3f8f6 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Mon, 13 Feb 2017 16:45:24 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 13 Feb 2017 17:22:33 -0300
perf evsel: Inform how to make a sysctl setting permanent
When a tool can't open counters due to the kernel.perf_event_paranoit sysctl setting, we inform how to tweak it to allow the operation to succeed, in addition to that, suggest setting /etc/sysctl.conf to make the setting permanent.
Suggested-by Ingo Molnar <[email protected]>
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Wang Nan <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/builtin-record.c | 2 +- tools/perf/builtin-stat.c | 2 +- tools/perf/builtin-top.c | 2 +- tools/perf/util/evsel.c | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-)
tools/perf/builtin-record.c +1 -1
@@ -418,7 +418,7 @@ static int record__mmap(struct record *rec)static int record__open (struct record *rec) { -char msg[512 ]; +char msg[BUFSIZ ];struct perf_evsel *pos;struct perf_evlist *evlist = rec->evlist;struct perf_session *session = rec->session;
tools/perf/builtin-stat.c +1 -1
@@ -533,7 +533,7 @@ static int store_counter_ids(struct perf_evsel *counter)static int __run_perf_stat (int argc,const char **argv) {int interval = stat_config.interval; -char msg[512 ]; +char msg[BUFSIZ ];unsigned long long t0, t1;struct perf_evsel *counter;struct timespec ts;
tools/perf/builtin-top.c +1 -1
@@ -859,7 +859,7 @@ static void perf_top__mmap_read(struct perf_top *top)static int perf_top__start_counters (struct perf_top *top) { -char msg[512 ]; +char msg[BUFSIZ ];struct perf_evsel *counter;struct perf_evlist *evlist = top->evlist;struct record_opts *opts = &top->record_opts;
tools/perf/util/evsel.c +3 -1
@@ -2469,7 +2469,9 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target," -1: Allow use of (almost) all events by all users\n" ">= 0: Disallow raw tracepoint access by users without CAP_IOC_LOCK\n" ">= 1: Disallow CPU event access by users without CAP_SYS_ADMIN\n" -">= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN" , +">= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN\n\n" +"To make this setting permanent, edit /etc/sysctl.conf too, e.g.:\n\n" +" kernel.perf_event_paranoid = -1\n" , target->system_wide ?"system-wide " :"" , perf_event_paranoid());case ENOENT :