From: jolsa@redhat.com (Jiri Olsa)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2] perf tools: adding support for address filters
Date: Wed, 31 Aug 2016 08:57:31 +0200 [thread overview]
Message-ID: <20160831065731.GA31764@krava> (raw)
In-Reply-To: <1472573415-3618-1-git-send-email-mathieu.poirier@linaro.org>
On Tue, Aug 30, 2016 at 10:10:15AM -0600, Mathieu Poirier wrote:
> This patch makes it possible to use the current filter
> framework with address filters. That way address filters for
> HW tracers such as CoreSight and IntelPT can be communicated
> to the kernel drivers.
>
> CC: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
>
> ---
> Changes for V2:
> - Rebased to v4.8-rc4.
> - Revisited error path.
> ---
>
> tools/perf/util/parse-events.c | 30 +++++++++++++++++++++++++-----
> 1 file changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index 2eb8b1ed4cc8..1df413fbf7f8 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -1760,12 +1760,26 @@ foreach_evsel_in_last_glob(struct perf_evlist *evlist,
> static int set_filter(struct perf_evsel *evsel, const void *arg)
> {
> const char *str = arg;
> + bool found = false;
> + int nr_addr_filters = 0;
> + struct perf_pmu *pmu = NULL;
>
> - if (evsel == NULL || evsel->attr.type != PERF_TYPE_TRACEPOINT) {
> - fprintf(stderr,
> - "--filter option should follow a -e tracepoint option\n");
> - return -1;
> - }
> + if (evsel == NULL)
> + goto err;
> +
> + while ((pmu = perf_pmu__scan(pmu)) != NULL)
> + if (pmu->type == evsel->attr.type) {
> + found = true;
> + break;
> + }
> +
> + if (found)
> + perf_pmu__scan_file(pmu, "nr_addr_filters",
> + "%d", &nr_addr_filters);
> +
> +
> + if (evsel->attr.type != PERF_TYPE_TRACEPOINT && !nr_addr_filters)
> + goto err;
should we display another error message for !nr_addr_filters case?
the one below is misleading in this case
jirka
>
> if (perf_evsel__append_filter(evsel, "&&", str) < 0) {
> fprintf(stderr,
> @@ -1774,6 +1788,12 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)
> }
>
> return 0;
> +
> +err:
> + fprintf(stderr,
> + "--filter option should follow a -e tracepoint or HW tracer option\n");
> +
> + return -1;
> }
>
> int parse_filter(const struct option *opt, const char *str,
> --
> 2.7.4
>
WARNING: multiple messages have this Message-ID (diff)
From: Jiri Olsa <jolsa@redhat.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: acme@kernel.org, mingo@redhat.com, peterz@infradead.org,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
acme@infradead.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH V2] perf tools: adding support for address filters
Date: Wed, 31 Aug 2016 08:57:31 +0200 [thread overview]
Message-ID: <20160831065731.GA31764@krava> (raw)
In-Reply-To: <1472573415-3618-1-git-send-email-mathieu.poirier@linaro.org>
On Tue, Aug 30, 2016 at 10:10:15AM -0600, Mathieu Poirier wrote:
> This patch makes it possible to use the current filter
> framework with address filters. That way address filters for
> HW tracers such as CoreSight and IntelPT can be communicated
> to the kernel drivers.
>
> CC: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
>
> ---
> Changes for V2:
> - Rebased to v4.8-rc4.
> - Revisited error path.
> ---
>
> tools/perf/util/parse-events.c | 30 +++++++++++++++++++++++++-----
> 1 file changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index 2eb8b1ed4cc8..1df413fbf7f8 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -1760,12 +1760,26 @@ foreach_evsel_in_last_glob(struct perf_evlist *evlist,
> static int set_filter(struct perf_evsel *evsel, const void *arg)
> {
> const char *str = arg;
> + bool found = false;
> + int nr_addr_filters = 0;
> + struct perf_pmu *pmu = NULL;
>
> - if (evsel == NULL || evsel->attr.type != PERF_TYPE_TRACEPOINT) {
> - fprintf(stderr,
> - "--filter option should follow a -e tracepoint option\n");
> - return -1;
> - }
> + if (evsel == NULL)
> + goto err;
> +
> + while ((pmu = perf_pmu__scan(pmu)) != NULL)
> + if (pmu->type == evsel->attr.type) {
> + found = true;
> + break;
> + }
> +
> + if (found)
> + perf_pmu__scan_file(pmu, "nr_addr_filters",
> + "%d", &nr_addr_filters);
> +
> +
> + if (evsel->attr.type != PERF_TYPE_TRACEPOINT && !nr_addr_filters)
> + goto err;
should we display another error message for !nr_addr_filters case?
the one below is misleading in this case
jirka
>
> if (perf_evsel__append_filter(evsel, "&&", str) < 0) {
> fprintf(stderr,
> @@ -1774,6 +1788,12 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)
> }
>
> return 0;
> +
> +err:
> + fprintf(stderr,
> + "--filter option should follow a -e tracepoint or HW tracer option\n");
> +
> + return -1;
> }
>
> int parse_filter(const struct option *opt, const char *str,
> --
> 2.7.4
>
next prev parent reply other threads:[~2016-08-31 6:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-30 16:10 [PATCH V2] perf tools: adding support for address filters Mathieu Poirier
2016-08-30 16:10 ` Mathieu Poirier
2016-08-31 6:57 ` Jiri Olsa [this message]
2016-08-31 6:57 ` Jiri Olsa
2016-08-31 16:30 ` Mathieu Poirier
2016-08-31 16:30 ` Mathieu Poirier
2016-08-31 18:40 ` Jiri Olsa
2016-08-31 18:40 ` Jiri Olsa
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=20160831065731.GA31764@krava \
--to=jolsa@redhat.com \
--cc=linux-arm-kernel@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.