From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
linux-perf-users@vger.kernel.org
Subject: [PATCH] perf bpf filter: Add an error message for BPF filter
Date: Fri, 17 Mar 2023 17:22:18 -0700 [thread overview]
Message-ID: <20230318002218.2035109-1-namhyung@kernel.org> (raw)
Currently there's no error message for filter (other than the help for
the option) when it's built with NO_BPF_SKEL=1. It should show the
BPF filter is not supported like below:
$ sudo ./perf record -e cycles --filter ip==1 true
BPF filter is not supported <------------------- added
Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
--filter <filter>
event filter
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/parse-events.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 6c5cf5244486..f1fa469712c4 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -2543,8 +2543,16 @@ static int set_filter(struct evsel *evsel, const void *arg)
perf_pmu__scan_file(pmu, "nr_addr_filters",
"%d", &nr_addr_filters);
- if (!nr_addr_filters)
- return perf_bpf_filter__parse(&evsel->bpf_filters, str);
+ if (!nr_addr_filters) {
+ int ret = perf_bpf_filter__parse(&evsel->bpf_filters, str);
+
+ if (ret == -EOPNOTSUPP)
+ fprintf(stderr, "BPF filter is not supported\n");
+ else if (ret)
+ fprintf(stderr, "failed to set the BPF filter\n");
+
+ return ret;
+ }
if (evsel__append_addr_filter(evsel, str) < 0) {
fprintf(stderr,
--
2.40.0.rc1.284.g88254d51c5-goog
reply other threads:[~2023-03-18 0:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230318002218.2035109-1-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).