Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1484408 > unrolled thread
| Started by | Mathieu Poirier <mathieu.poirier@linaro.org> |
|---|---|
| First post | 2016-09-15 18:40 +0200 |
| Last post | 2016-09-16 15:00 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH V6 0/3] Adding support for address filters Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-09-15 18:40 +0200
[PATCH V6 3/3] perf tools: adding support for address filters Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-09-15 18:40 +0200
Re: [PATCH V6 3/3] perf tools: adding support for address filters Adrian Hunter <adrian.hunter@intel.com> - 2016-09-16 14:50 +0200
Re: [PATCH V6 0/3] Adding support for address filters Adrian Hunter <adrian.hunter@intel.com> - 2016-09-16 15:00 +0200
| From | Mathieu Poirier <mathieu.poirier@linaro.org> |
|---|---|
| Date | 2016-09-15 18:40 +0200 |
| Subject | [PATCH V6 0/3] Adding support for address filters |
| Message-ID | <shHRD-ZC-3@gated-at.bofh.it> |
This patch set 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. In this revision precursor work is done to make function perf_evsel__append_filter() generic, along with changes to current customers. From there the work on address filters is introduced. Thanks, Mathieu --- Changes for V6: - Split work in 3 (small) patches. - Adding tracepoint and address filter append() functions Changes for V5: - Modified perf_evsel__append_filter() to take a string format rather than an operation. Changes for V4: - Added support for address filters over more than one nibble. - Removed Jiri's ack, this version is too different from what was reviewed. Changes for V3: - Added Jiri's ack. - Rebased to v4.8-rc5. Changes for V2: - Rebased to v4.8-rc4. - Revisited error path. Mathieu Poirier (3): perf tools: making perf_evsel__append_filter() generic perf tools: new tracepoint specific function perf tools: adding support for address filters tools/perf/builtin-trace.c | 8 ++++++-- tools/perf/util/evsel.c | 16 +++++++++++++--- tools/perf/util/evsel.h | 5 +++-- tools/perf/util/parse-events.c | 41 +++++++++++++++++++++++++++++++++++------ 4 files changed, 57 insertions(+), 13 deletions(-) -- 2.7.4
[toc] | [next] | [standalone]
| From | Mathieu Poirier <mathieu.poirier@linaro.org> |
|---|---|
| Date | 2016-09-15 18:40 +0200 |
| Subject | [PATCH V6 3/3] perf tools: adding support for address filters |
| Message-ID | <shHRE-ZC-33@gated-at.bofh.it> |
| In reply to | #1484408 |
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.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
tools/perf/util/evsel.c | 5 +++++
tools/perf/util/evsel.h | 2 ++
tools/perf/util/parse-events.c | 39 ++++++++++++++++++++++++++++++++++-----
3 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index a99e82d97df2..e0bb399dcdd4 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1067,6 +1067,11 @@ int perf_evsel__append_tp_filter(struct perf_evsel *evsel, const char *filter)
return perf_evsel__append_filter(evsel, "(%s) && (%s)", filter);
}
+int perf_evsel__append_addr_filter(struct perf_evsel *evsel, const char *filter)
+{
+ return perf_evsel__append_filter(evsel, "%s,%s", filter);
+}
+
int perf_evsel__enable(struct perf_evsel *evsel)
{
int nthreads = thread_map__nr(evsel->threads);
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 36ed0997e65b..49c51fb3d05c 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -234,6 +234,8 @@ void perf_evsel__set_sample_id(struct perf_evsel *evsel,
int perf_evsel__set_filter(struct perf_evsel *evsel, const char *filter);
int perf_evsel__append_tp_filter(struct perf_evsel *evsel, const char *filter);
+int perf_evsel__append_addr_filter(struct perf_evsel *evsel,
+ const char *filter);
int perf_evsel__apply_filter(struct perf_evsel *evsel, int ncpus, int nthreads,
const char *filter);
int perf_evsel__enable(struct perf_evsel *evsel);
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 751b48fc641c..c23f2d5fc134 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1755,20 +1755,49 @@ 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;
+
+ if (evsel->attr.type == PERF_TYPE_TRACEPOINT) {
+ if (perf_evsel__append_tp_filter(evsel, str) < 0) {
+ fprintf(stderr,
+ "not enough memory to hold filter string\n");
+ return -1;
+ }
+
+ return 0;
}
- if (perf_evsel__append_tp_filter(evsel, str) < 0) {
+ 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 (!nr_addr_filters)
+ goto err;
+
+ if (perf_evsel__append_addr_filter(evsel, str) < 0) {
fprintf(stderr,
"not enough memory to hold filter string\n");
return -1;
}
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
[toc] | [prev] | [next] | [standalone]
| From | Adrian Hunter <adrian.hunter@intel.com> |
|---|---|
| Date | 2016-09-16 14:50 +0200 |
| Subject | Re: [PATCH V6 3/3] perf tools: adding support for address filters |
| Message-ID | <si0KC-4Md-27@gated-at.bofh.it> |
| In reply to | #1484409 |
On 15/09/16 19:37, 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
IntelPT -> Intel PT
> to the kernel drivers.
>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Otherwise:
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> tools/perf/util/evsel.c | 5 +++++
> tools/perf/util/evsel.h | 2 ++
> tools/perf/util/parse-events.c | 39 ++++++++++++++++++++++++++++++++++-----
> 3 files changed, 41 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index a99e82d97df2..e0bb399dcdd4 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -1067,6 +1067,11 @@ int perf_evsel__append_tp_filter(struct perf_evsel *evsel, const char *filter)
> return perf_evsel__append_filter(evsel, "(%s) && (%s)", filter);
> }
>
> +int perf_evsel__append_addr_filter(struct perf_evsel *evsel, const char *filter)
> +{
> + return perf_evsel__append_filter(evsel, "%s,%s", filter);
> +}
> +
> int perf_evsel__enable(struct perf_evsel *evsel)
> {
> int nthreads = thread_map__nr(evsel->threads);
> diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
> index 36ed0997e65b..49c51fb3d05c 100644
> --- a/tools/perf/util/evsel.h
> +++ b/tools/perf/util/evsel.h
> @@ -234,6 +234,8 @@ void perf_evsel__set_sample_id(struct perf_evsel *evsel,
>
> int perf_evsel__set_filter(struct perf_evsel *evsel, const char *filter);
> int perf_evsel__append_tp_filter(struct perf_evsel *evsel, const char *filter);
> +int perf_evsel__append_addr_filter(struct perf_evsel *evsel,
> + const char *filter);
> int perf_evsel__apply_filter(struct perf_evsel *evsel, int ncpus, int nthreads,
> const char *filter);
> int perf_evsel__enable(struct perf_evsel *evsel);
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index 751b48fc641c..c23f2d5fc134 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -1755,20 +1755,49 @@ 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;
> +
> + if (evsel->attr.type == PERF_TYPE_TRACEPOINT) {
> + if (perf_evsel__append_tp_filter(evsel, str) < 0) {
> + fprintf(stderr,
> + "not enough memory to hold filter string\n");
> + return -1;
> + }
> +
> + return 0;
> }
>
> - if (perf_evsel__append_tp_filter(evsel, str) < 0) {
> + 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 (!nr_addr_filters)
> + goto err;
> +
> + if (perf_evsel__append_addr_filter(evsel, str) < 0) {
> fprintf(stderr,
> "not enough memory to hold filter string\n");
> return -1;
> }
>
> 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,
>
[toc] | [prev] | [next] | [standalone]
| From | Adrian Hunter <adrian.hunter@intel.com> |
|---|---|
| Date | 2016-09-16 15:00 +0200 |
| Message-ID | <si0Ui-4PI-11@gated-at.bofh.it> |
| In reply to | #1484408 |
On 15/09/16 19:37, Mathieu Poirier wrote: > This patch set 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. FYI, I am working on patches to add support for entering address filters using symbol names. I will probably send them next week. > > In this revision precursor work is done to make function > perf_evsel__append_filter() generic, along with changes to > current customers. From there the work on address filters is > introduced. > > Thanks, > Mathieu > > --- > Changes for V6: > - Split work in 3 (small) patches. > - Adding tracepoint and address filter append() functions > > Changes for V5: > - Modified perf_evsel__append_filter() to take a string format > rather than an operation. > > Changes for V4: > - Added support for address filters over more than one > nibble. > - Removed Jiri's ack, this version is too different from > what was reviewed. > > Changes for V3: > - Added Jiri's ack. > - Rebased to v4.8-rc5. > > Changes for V2: > - Rebased to v4.8-rc4. > - Revisited error path. > > Mathieu Poirier (3): > perf tools: making perf_evsel__append_filter() generic > perf tools: new tracepoint specific function > perf tools: adding support for address filters > > tools/perf/builtin-trace.c | 8 ++++++-- > tools/perf/util/evsel.c | 16 +++++++++++++--- > tools/perf/util/evsel.h | 5 +++-- > tools/perf/util/parse-events.c | 41 +++++++++++++++++++++++++++++++++++------ > 4 files changed, 57 insertions(+), 13 deletions(-) >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web