From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751904AbdILT4z (ORCPT ); Tue, 12 Sep 2017 15:56:55 -0400 Received: from mga02.intel.com ([134.134.136.20]:50591 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751712AbdILT4w (ORCPT ); Tue, 12 Sep 2017 15:56:52 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,384,1500966000"; d="scan'208";a="128086148" From: Andi Kleen To: acme@kernel.org Cc: jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH 2/2] perf, tools: Don't force MetricExprs to lower case Date: Tue, 12 Sep 2017 12:56:43 -0700 Message-Id: <20170912195643.2611-2-andi@firstfloor.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170912195643.2611-1-andi@firstfloor.org> References: <20170912195643.2611-1-andi@firstfloor.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen There are still problems with BPF misinterpreting some events that include .c. An earlier fix made it work for stand alone aliases, but it still fails for more complex constructs. REJECT keeps trying and trying a shorter string until .c is matched and it appears like a valid BPF path. % perf stat -e cpu/uops_executed.core,cmask=1/ true bpf: builtin compilation failed: -95, try external compiler ERROR: problems with path cpu/uops_executed.c: No such file or directory event syntax error: 'cpu/uops_executed.core,cmask=1/' \___ Failed to load cpu/uops_executed.c from source: Error when compiling BPF scriptlet I tried to fix it, but it exceeds my flex knowledge, because REJECT does not interact well with BEGIN states. The BPF syntax in its current form really causes an ambigious grammar. A workaround for this is to spell the event upper case, because upper case .C does not match the BPF rules. This currently affects some of the ILP metrics. The previous patch changed the ILP metrics to use upper case. Now if we don't force everything to lower case the matching works. This makes ILP work correctly on my IvyBridge: % ./perf stat -M ILP true Performance counter stats for 'true': 711,067 UOPS_EXECUTED.THREAD # 2.3 ILP 311,680 cpu/UOPS_EXECUTED.CORE,cmask=1/ 311,680 UOPS_EXECUTED.CYCLES_GE_1_UOP_EXEC 0.000371554 seconds time elapsed Signed-off-by: Andi Kleen --- tools/perf/pmu-events/jevents.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c index 9eb7047bafe4..07c0f9a46180 100644 --- a/tools/perf/pmu-events/jevents.c +++ b/tools/perf/pmu-events/jevents.c @@ -488,8 +488,6 @@ int json_events(const char *fn, addfield(map, &metric_group, "", "", val); } else if (json_streq(map, field, "MetricExpr")) { addfield(map, &metric_expr, "", "", val); - for (s = metric_expr; *s; s++) - *s = tolower(*s); } /* ignore unknown fields */ } -- 2.9.5