Skip to content

Commit d6195a6

Browse files
committed
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]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent e8c6f43 commit d6195a6

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

tools/perf/builtin-record.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ static int record__mmap(struct record *rec)
418418

419419
static int record__open(struct record *rec)
420420
{
421-
char msg[512];
421+
char msg[BUFSIZ];
422422
struct perf_evsel *pos;
423423
struct perf_evlist *evlist = rec->evlist;
424424
struct perf_session *session = rec->session;

tools/perf/builtin-stat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ static int store_counter_ids(struct perf_evsel *counter)
533533
static int __run_perf_stat(int argc, const char **argv)
534534
{
535535
int interval = stat_config.interval;
536-
char msg[512];
536+
char msg[BUFSIZ];
537537
unsigned long long t0, t1;
538538
struct perf_evsel *counter;
539539
struct timespec ts;

tools/perf/builtin-top.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ static void perf_top__mmap_read(struct perf_top *top)
859859

860860
static int perf_top__start_counters(struct perf_top *top)
861861
{
862-
char msg[512];
862+
char msg[BUFSIZ];
863863
struct perf_evsel *counter;
864864
struct perf_evlist *evlist = top->evlist;
865865
struct record_opts *opts = &top->record_opts;

tools/perf/util/evsel.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2469,7 +2469,9 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
24692469
" -1: Allow use of (almost) all events by all users\n"
24702470
">= 0: Disallow raw tracepoint access by users without CAP_IOC_LOCK\n"
24712471
">= 1: Disallow CPU event access by users without CAP_SYS_ADMIN\n"
2472-
">= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN",
2472+
">= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN\n\n"
2473+
"To make this setting permanent, edit /etc/sysctl.conf too, e.g.:\n\n"
2474+
" kernel.perf_event_paranoid = -1\n" ,
24732475
target->system_wide ? "system-wide " : "",
24742476
perf_event_paranoid());
24752477
case ENOENT:

0 commit comments

Comments
 (0)