linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] perf parser: Improve error message for PMU address filters
@ 2018-07-04 12:13 Jack Henschel
  2018-07-04 15:25 ` Jiri Olsa
  2018-08-23  8:37 ` [tip:perf/urgent] " tip-bot for Jack Henschel
  0 siblings, 2 replies; 4+ messages in thread
From: Jack Henschel @ 2018-07-04 12:13 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Alexander Shishkin, Jiri Olsa
  Cc: linux-kernel, linux-perf-users, Jack Henschel

This is the second version of a patch that improves the error
message of the perf events parser when the PMU hardware does not support
address filters.

Previously, the perf returned the following error:
> $ perf record -e intel_pt// --filter 'filter sys_write'
> --filter option should follow a -e tracepoint or HW tracer option
This implies there is some syntax error present in the command line,
which is not true. Rather, notify the user that the CPU does not have
support for this feature.

For example, Intel chips based on the Broadwell micro-archticture have
the Intel PT PMU, but do not support address filtering.

Now, perf prints the following error message:
> $ perf record -e intel_pt// --filter 'filter sys_write'
> This CPU does not support address filtering

Signed-off-by: Jack Henschel <jackdev@mailbox.org>
---
 tools/perf/util/parse-events.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 15eec49e71a1..f8cd3e7c9186 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1991,8 +1991,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)
 	int nr_addr_filters = 0;
 	struct perf_pmu *pmu = NULL;
 
-	if (evsel == NULL)
-		goto err;
+	if (evsel == NULL) {
+		fprintf(stderr,
+			"--filter option should follow a -e tracepoint or HW tracer option\n");
+		return -1;
+	}
 
 	if (evsel->attr.type == PERF_TYPE_TRACEPOINT) {
 		if (perf_evsel__append_tp_filter(evsel, str) < 0) {
@@ -2014,8 +2017,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)
 		perf_pmu__scan_file(pmu, "nr_addr_filters",
 				    "%d", &nr_addr_filters);
 
-	if (!nr_addr_filters)
-		goto err;
+	if (!nr_addr_filters) {
+		fprintf(stderr,
+			"This CPU does not support address filtering\n");
+		return -1;
+	}
 
 	if (perf_evsel__append_addr_filter(evsel, str) < 0) {
 		fprintf(stderr,
@@ -2024,12 +2030,6 @@ 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.18.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] perf parser: Improve error message for PMU address filters
  2018-07-04 12:13 [PATCH V2] perf parser: Improve error message for PMU address filters Jack Henschel
@ 2018-07-04 15:25 ` Jiri Olsa
  2018-08-15 19:39   ` Arnaldo Carvalho de Melo
  2018-08-23  8:37 ` [tip:perf/urgent] " tip-bot for Jack Henschel
  1 sibling, 1 reply; 4+ messages in thread
From: Jiri Olsa @ 2018-07-04 15:25 UTC (permalink / raw)
  To: Jack Henschel
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Alexander Shishkin, linux-kernel, linux-perf-users

On Wed, Jul 04, 2018 at 02:13:45PM +0200, Jack Henschel wrote:
> This is the second version of a patch that improves the error
> message of the perf events parser when the PMU hardware does not support
> address filters.
> 
> Previously, the perf returned the following error:
> > $ perf record -e intel_pt// --filter 'filter sys_write'
> > --filter option should follow a -e tracepoint or HW tracer option
> This implies there is some syntax error present in the command line,
> which is not true. Rather, notify the user that the CPU does not have
> support for this feature.
> 
> For example, Intel chips based on the Broadwell micro-archticture have
> the Intel PT PMU, but do not support address filtering.
> 
> Now, perf prints the following error message:
> > $ perf record -e intel_pt// --filter 'filter sys_write'
> > This CPU does not support address filtering
> 
> Signed-off-by: Jack Henschel <jackdev@mailbox.org>

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

> ---
>  tools/perf/util/parse-events.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index 15eec49e71a1..f8cd3e7c9186 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -1991,8 +1991,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)
>  	int nr_addr_filters = 0;
>  	struct perf_pmu *pmu = NULL;
>  
> -	if (evsel == NULL)
> -		goto err;
> +	if (evsel == NULL) {
> +		fprintf(stderr,
> +			"--filter option should follow a -e tracepoint or HW tracer option\n");
> +		return -1;
> +	}
>  
>  	if (evsel->attr.type == PERF_TYPE_TRACEPOINT) {
>  		if (perf_evsel__append_tp_filter(evsel, str) < 0) {
> @@ -2014,8 +2017,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)
>  		perf_pmu__scan_file(pmu, "nr_addr_filters",
>  				    "%d", &nr_addr_filters);
>  
> -	if (!nr_addr_filters)
> -		goto err;
> +	if (!nr_addr_filters) {
> +		fprintf(stderr,
> +			"This CPU does not support address filtering\n");
> +		return -1;
> +	}
>  
>  	if (perf_evsel__append_addr_filter(evsel, str) < 0) {
>  		fprintf(stderr,
> @@ -2024,12 +2030,6 @@ 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.18.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] perf parser: Improve error message for PMU address filters
  2018-07-04 15:25 ` Jiri Olsa
@ 2018-08-15 19:39   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-08-15 19:39 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jack Henschel, Peter Zijlstra, Ingo Molnar, Alexander Shishkin,
	linux-kernel, linux-perf-users

Em Wed, Jul 04, 2018 at 05:25:36PM +0200, Jiri Olsa escreveu:
> On Wed, Jul 04, 2018 at 02:13:45PM +0200, Jack Henschel wrote:
> > This is the second version of a patch that improves the error
> > message of the perf events parser when the PMU hardware does not support
> > address filters.
> > 
> > Previously, the perf returned the following error:
> > > $ perf record -e intel_pt// --filter 'filter sys_write'
> > > --filter option should follow a -e tracepoint or HW tracer option
> > This implies there is some syntax error present in the command line,
> > which is not true. Rather, notify the user that the CPU does not have
> > support for this feature.
> > 
> > For example, Intel chips based on the Broadwell micro-archticture have
> > the Intel PT PMU, but do not support address filtering.
> > 
> > Now, perf prints the following error message:
> > > $ perf record -e intel_pt// --filter 'filter sys_write'
> > > This CPU does not support address filtering
> > 
> > Signed-off-by: Jack Henschel <jackdev@mailbox.org>
> 
> Acked-by: Jiri Olsa <jolsa@kernel.org>

Thanks, tested and applied,

- Arnaldo
 
> thanks,
> jirka
> 
> > ---
> >  tools/perf/util/parse-events.c | 20 ++++++++++----------
> >  1 file changed, 10 insertions(+), 10 deletions(-)
> > 
> > diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> > index 15eec49e71a1..f8cd3e7c9186 100644
> > --- a/tools/perf/util/parse-events.c
> > +++ b/tools/perf/util/parse-events.c
> > @@ -1991,8 +1991,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)
> >  	int nr_addr_filters = 0;
> >  	struct perf_pmu *pmu = NULL;
> >  
> > -	if (evsel == NULL)
> > -		goto err;
> > +	if (evsel == NULL) {
> > +		fprintf(stderr,
> > +			"--filter option should follow a -e tracepoint or HW tracer option\n");
> > +		return -1;
> > +	}
> >  
> >  	if (evsel->attr.type == PERF_TYPE_TRACEPOINT) {
> >  		if (perf_evsel__append_tp_filter(evsel, str) < 0) {
> > @@ -2014,8 +2017,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)
> >  		perf_pmu__scan_file(pmu, "nr_addr_filters",
> >  				    "%d", &nr_addr_filters);
> >  
> > -	if (!nr_addr_filters)
> > -		goto err;
> > +	if (!nr_addr_filters) {
> > +		fprintf(stderr,
> > +			"This CPU does not support address filtering\n");
> > +		return -1;
> > +	}
> >  
> >  	if (perf_evsel__append_addr_filter(evsel, str) < 0) {
> >  		fprintf(stderr,
> > @@ -2024,12 +2030,6 @@ 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.18.0
> > 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:perf/urgent] perf parser: Improve error message for PMU address filters
  2018-07-04 12:13 [PATCH V2] perf parser: Improve error message for PMU address filters Jack Henschel
  2018-07-04 15:25 ` Jiri Olsa
@ 2018-08-23  8:37 ` tip-bot for Jack Henschel
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Jack Henschel @ 2018-08-23  8:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, linux-kernel, alexander.shishkin, jackdev, jolsa, tglx,
	acme, hpa, peterz

Commit-ID:  49836f7811f383d8613661fff110ce74f4710d52
Gitweb:     https://git.kernel.org/tip/49836f7811f383d8613661fff110ce74f4710d52
Author:     Jack Henschel <jackdev@mailbox.org>
AuthorDate: Wed, 4 Jul 2018 14:13:45 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 20 Aug 2018 08:54:58 -0300

perf parser: Improve error message for PMU address filters

This is the second version of a patch that improves the error message of
the perf events parser when the PMU hardware does not support address
filters.

Previously, the perf returned the following error:

  $ perf record -e intel_pt// --filter 'filter sys_write'
  --filter option should follow a -e tracepoint or HW tracer option

This implies there is some syntax error present in the command line,
which is not true. Rather, notify the user that the CPU does not have
support for this feature.

For example, Intel chips based on the Broadwell micro-archticture have
the Intel PT PMU, but do not support address filtering.

Now, perf prints the following error message:

  $ perf record -e intel_pt// --filter 'filter sys_write'
  This CPU does not support address filtering

Signed-off-by: Jack Henschel <jackdev@mailbox.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180704121345.19025-1-jackdev@mailbox.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/parse-events.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 15eec49e71a1..f8cd3e7c9186 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1991,8 +1991,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)
 	int nr_addr_filters = 0;
 	struct perf_pmu *pmu = NULL;
 
-	if (evsel == NULL)
-		goto err;
+	if (evsel == NULL) {
+		fprintf(stderr,
+			"--filter option should follow a -e tracepoint or HW tracer option\n");
+		return -1;
+	}
 
 	if (evsel->attr.type == PERF_TYPE_TRACEPOINT) {
 		if (perf_evsel__append_tp_filter(evsel, str) < 0) {
@@ -2014,8 +2017,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)
 		perf_pmu__scan_file(pmu, "nr_addr_filters",
 				    "%d", &nr_addr_filters);
 
-	if (!nr_addr_filters)
-		goto err;
+	if (!nr_addr_filters) {
+		fprintf(stderr,
+			"This CPU does not support address filtering\n");
+		return -1;
+	}
 
 	if (perf_evsel__append_addr_filter(evsel, str) < 0) {
 		fprintf(stderr,
@@ -2024,12 +2030,6 @@ 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,

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-23  9:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-04 12:13 [PATCH V2] perf parser: Improve error message for PMU address filters Jack Henschel
2018-07-04 15:25 ` Jiri Olsa
2018-08-15 19:39   ` Arnaldo Carvalho de Melo
2018-08-23  8:37 ` [tip:perf/urgent] " tip-bot for Jack Henschel

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).