All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: acme@kernel.org
Cc: jolsa@kernel.org, linux-kernel@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 2/2] perf, tools: Don't force MetricExprs to lower case
Date: Tue, 12 Sep 2017 12:56:43 -0700	[thread overview]
Message-ID: <20170912195643.2611-2-andi@firstfloor.org> (raw)
In-Reply-To: <20170912195643.2611-1-andi@firstfloor.org>

From: Andi Kleen <ak@linux.intel.com>

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 <ak@linux.intel.com>
---
 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

  reply	other threads:[~2017-09-12 19:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-12 19:56 [PATCH 1/2] perf, tools, json: Fix ILP metrics Andi Kleen
2017-09-12 19:56 ` Andi Kleen [this message]
2017-10-03 16:06   ` [PATCH 2/2] perf, tools: Don't force MetricExprs to lower case Arnaldo Carvalho de Melo
2017-10-04 10:30     ` Jiri Olsa
2017-10-04 16:27       ` Andi Kleen
2017-10-09 13:41         ` Jiri Olsa
2017-10-09 14:07           ` Andi Kleen
2017-10-09 14:12             ` Arnaldo Carvalho de Melo
2017-10-09 14:39               ` Jiri Olsa
2017-10-09 14:51                 ` Arnaldo Carvalho de Melo
2017-10-09 15:39                 ` Andi Kleen
2017-10-12 15:31                 ` Wangnan (F)
2017-10-12 15:59                   ` Jiri Olsa
2017-10-12 16:07                     ` Wangnan (F)
2017-10-09 14:43             ` Jiri Olsa
2017-10-09 14:09           ` Arnaldo Carvalho de Melo
2017-10-09 14:41             ` Jiri Olsa
2017-10-12 15:13               ` Jiri Olsa
2017-10-12 21:53                 ` Andi Kleen
2017-10-28 23:10             ` [tip:perf/urgent] perf tools: Unwind properly location after REJECT tip-bot for Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170912195643.2611-2-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.