Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933338AbbBQKNt (ORCPT ); Tue, 17 Feb 2015 05:13:49 -0500 Received: from service87.mimecast.com ([91.220.42.44]:59211 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752052AbbBQKNr convert rfc822-to-8bit (ORCPT ); Tue, 17 Feb 2015 05:13:47 -0500 Message-ID: <54E31458.3060009@arm.com> Date: Tue, 17 Feb 2015 10:13:44 +0000 From: "Suzuki K. Poulose" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Arnaldo Carvalho de Melo , David Ahern CC: "linux-kernel@vger.kernel.org" , Jiri Olsa Subject: Re: [PATCHv2] perf/stat: Report unsupported events properly References: <1423852858-8455-1-git-send-email-suzuki.poulose@arm.com> <54DE52EC.50406@gmail.com> <20150213205026.GA31817@redhat.com> In-Reply-To: <20150213205026.GA31817@redhat.com> X-OriginalArrivalTime: 17 Feb 2015 10:13:44.0101 (UTC) FILETIME=[6903A550:01D04A9A] X-MC-Unique: 115021710134401701 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2749 Lines: 86 On 13/02/15 20:50, Arnaldo Carvalho de Melo wrote: > Em Fri, Feb 13, 2015 at 12:39:24PM -0700, David Ahern escreveu: >> >> >> On 02/13/2015 11:40 AM, Suzuki K. Poulose wrote: >>> From: "Suzuki K. Poulose" >>> >>> 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': >>> >>> 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 >>> Cc: Arnaldo Carvalho de Melo >>> Signed-off-by: Suzuki K. Poulose >>> --- >>> 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 > > Gack, 10ms after I sent my pre-California pull req :-\ > > Will go in the next one :-) I think this may need to goto 3.19 stable series as well. Missed that. Do you want me to send it there ? Cheers Suzuki -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/