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] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 13 Feb 2015 12:39:24 -0700
From:	David Ahern <dsahern@...il.com>
To:	"Suzuki K. Poulose" <suzuki.poulose@....com>,
	linux-kernel@...r.kernel.org
CC:	Jiri Olsa <jolsa@...nel.org>,
	Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [PATCHv2] perf/stat: Report unsupported events properly



On 02/13/2015 11:40 AM, Suzuki K. Poulose wrote:
> From: "Suzuki K. Poulose" <suzuki.poulose@....com>
>
> Commit 1971f59 (perf stat: Use read_counter in read_counter_aggr )
> broke the perf stat output for unsupported counters.
>
>   $ perf stat -v -a -C 0 -e CCI_400/config=24/ sleep 1
>   Warning:
>   CCI_400/config=24/ event is not supported by the kernel.
>
>    Performance counter stats for 'system wide':
>
>                    0      CCI_400/config=24/
>
>          1.080265400 seconds time elapsed
>
> Where it used to be :
>
> $ perf stat -v -a -C 0 -e CCI_400/config=24/ sleep 1
>   Warning:
>   CCI_400/config=24/ event is not supported by the kernel.
>
>    Performance counter stats for 'system wide':
>
>      <not supported>      CCI_400/config=24/
>
>          1.083840675 seconds time elapsed
>
> This patch fixes the issues by checking if the counter is supported,
> before reading and logging the counter value.
>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
> Signed-off-by: Suzuki K. Poulose <suzuki.poulose@....com>
> ---
>   tools/perf/builtin-stat.c |    5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index e598e4e..d28949d 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -510,6 +510,9 @@ static int read_counter(struct perf_evsel *counter)
>   	int ncpus = perf_evsel__nr_cpus(counter);
>   	int cpu, thread;
>
> +	if (!counter->supported)
> +		return -ENOENT;
> +
>   	if (counter->system_wide)
>   		nthreads = 1;
>
> @@ -1285,7 +1288,7 @@ static void print_counter_aggr(struct perf_evsel *counter, char *prefix)
>   	if (prefix)
>   		fprintf(output, "%s", prefix);
>
> -	if (scaled == -1) {
> +	if (scaled == -1 || !counter->supported) {
>   		fprintf(output, "%*s%s",
>   			csv_output ? 0 : 18,
>   			counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED,
>

Just hit this as well.

Acked-and-Tested-by: David Ahern <dsahern@...il.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ