lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180704102424.GA19164@krava>
Date:   Wed, 4 Jul 2018 12:24:24 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Jack Henschel <jackdev@...lbox.org>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Subject: Re: [PATCH] perf parser: Improve error message for PMU address
 filters

On Wed, Jul 04, 2018 at 11:54:09AM +0200, Jack Henschel wrote:
> This patch 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:
> > --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.

looks ok, but please provide real examples of those error outputs in changelog

thanks,
jirka

> 
> Signed-off-by: Jack Henschel <jackdev@...lbox.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
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ