From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755543AbbIIVLE (ORCPT ); Wed, 9 Sep 2015 17:11:04 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:46580 "EHLO e32.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752520AbbIIVK5 convert rfc822-to-8bit (ORCPT ); Wed, 9 Sep 2015 17:10:57 -0400 X-Helo: d03dlp02.boulder.ibm.com X-MailFrom: sukadev@linux.vnet.ibm.com X-RcptTo: linux-kernel@vger.kernel.org Date: Wed, 9 Sep 2015 13:58:58 -0700 From: Sukadev Bhattiprolu To: Andi Kleen Cc: acme@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH] perf, tools, pmu-events: Fix fixed counters on Intel Message-ID: <20150909205858.GA30739@us.ibm.com> References: <1441391602-11580-1-git-send-email-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <1441391602-11580-1-git-send-email-andi@firstfloor.org> X-Operating-System: Linux 2.0.32 on an i486 User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15090921-0005-0000-0000-000017E7624B Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andi, Andi Kleen [andi@firstfloor.org] wrote: | From: Andi Kleen | | [This patch is on top of Sukadev's json patchkit] I removed this line from the commit log... | | The JSON event lists use a different encoding for fixed counters | than perf for instructions and cycles (ref-cycles is ok) | | This lead to some common events like inst_retired.any | or cpu_clk_unhalted.thread not counting, when specified with their | JSON name. | | Special case these events in the jevents conversion process. | I prefer to not touch the JSON files for this, as it's intended | that standard JSON files can be just dropped into the perf | build without changes. | | Signed-off-by: Andi Kleen | --- | tools/perf/pmu-events/jevents.c | 25 +++++++++++++++++++++++-- | 1 file changed, 23 insertions(+), 2 deletions(-) | | diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c | index 7347cca..f4e5903 100644 | --- a/tools/perf/pmu-events/jevents.c | +++ b/tools/perf/pmu-events/jevents.c | @@ -237,6 +237,28 @@ static void print_events_table_suffix(FILE *outfp) | fprintf(outfp, "};\n"); | } | | +static struct fixed { | + const char *name; | + const char *event; | +} fixed[] = { | + { "inst_retired.any", "event=0xc0" }, | + { "cpu_clk_unhalted.thread", "event=0x3c" }, | + { "cpu_clk_unhalted.thread_any", "event=0x3c,any=1" }, | + {}, ...and replaced this line with: {NULL, NULL}, to fix the compile error: pmu-events/jevents.c:247:2: error: missing initializer for field ‘name’ of ‘struct fixed’ [-Werror=missing-field-initializers] {}, After this I was able to get non-zero counts for the 'inst_retired.any' event on my system. Without the patch, I get 0 count for the event. I pushed this commit to the 'json-v16' branch. I also noticed an "Unknown MSR" message when building 'jevents': CC /root/suka/linux-acme.git/tools/perf/perf-obj/pmu-events/jevents.o LD /root/suka/linux-acme.git/tools/perf/perf-obj/pmu-events/jevents-in.o LINK /root/suka/linux-acme.git/tools/perf/perf-obj/pmu-events/jevents GEN /root/suka/linux-acme.git/tools/perf/perf-obj/pmu-events/pmu-events.c jevents: Unknown MSR in event file 0x3F7 The message is unrelated to the current patch and seems to show up when processing: tools/perf/pmu-events/arch/x86/Skylake_core.json (Note that you have to merge the 'json-files-7' branch with 'json-v16' to get the JSON files and hence the error). Thanks, Sukadev