From: Masami Hiramatsu <mhiramat@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Ravi Bangoria <ravi.bangoria@linux.ibm.com>,
Jiri Olsa <jolsa@kernel.org>,
linux-kernel@vger.kernel.org, aneesh.kumar@linux.ibm.com,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Ian Rogers <irogers@google.com>
Subject: [PATCH 2/2] perf/probe: Report permission error for tracefs error
Date: Sat, 5 Jun 2021 00:31:08 +0900 [thread overview]
Message-ID: <162282066829.448336.16156999655071988915.stgit@devnote2> (raw)
In-Reply-To: <162282064848.448336.15589262399731095367.stgit@devnote2>
Report permission error for the tracefs access error.
This can happen when non-superuser runs perf probe.
With this patch, perf probe shows the following message.
$ perf probe -l
No permission to access tracefs. Please run this command again with sudo.
Error: Failed to show event list.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
tools/perf/util/probe-file.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index 52273542e6ef..52d878f5a44d 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -48,6 +48,8 @@ static void print_open_warning(int err, bool uprobe)
uprobe ? 'u' : 'k', config);
} else if (err == -ENOTSUP)
pr_warning("Tracefs or debugfs is not mounted.\n");
+ else if (err == -EACCES)
+ pr_warning("No permission to access tracefs. Please run this command again with sudo.\n");
else
pr_warning("Failed to open %cprobe_events: %s\n",
uprobe ? 'u' : 'k',
@@ -62,6 +64,8 @@ static void print_both_open_warning(int kerr, int uerr)
else if (kerr == -ENOENT && uerr == -ENOENT)
pr_warning("Please rebuild kernel with CONFIG_KPROBE_EVENTS "
"or/and CONFIG_UPROBE_EVENTS.\n");
+ else if (kerr == -EACCES && uerr == -EACCES)
+ pr_warning("No permission to access tracefs. Please run this command again with sudo.\n");
else {
char sbuf[STRERR_BUFSIZE];
pr_warning("Failed to open kprobe events: %s.\n",
next prev parent reply other threads:[~2021-06-04 15:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-04 15:30 [PATCH 0/2] perf probe: Report permission errors Masami Hiramatsu
2021-06-04 15:30 ` [PATCH 1/2] perf/probe: Report possible permission error for map__load failure Masami Hiramatsu
2021-06-04 19:18 ` Arnaldo Carvalho de Melo
2021-06-06 7:11 ` Namhyung Kim
2021-06-07 0:00 ` Masami Hiramatsu
2021-06-08 12:24 ` Arnaldo Carvalho de Melo
2021-06-04 15:31 ` Masami Hiramatsu [this message]
2021-06-04 19:18 ` [PATCH 2/2] perf/probe: Report permission error for tracefs error Arnaldo Carvalho de Melo
2021-06-05 3:56 ` Masami Hiramatsu
2021-06-06 15:49 ` [PATCH v2] perf/probe: Report permission error for tracefs access Masami Hiramatsu
2021-06-08 17:13 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=162282066829.448336.16156999655071988915.stgit@devnote2 \
--to=mhiramat@kernel.org \
--cc=acme@kernel.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome