Re: [PATCH 2/8] perf metrics: fix parse errors in cascade lake metrics

From: Ian Rogers
Date: Thu Apr 23 2020 - 10:34:32 EST


On Thu, Apr 23, 2020 at 3:11 AM Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
>
> On Thu, Apr 23, 2020 at 12:10:36PM +0200, Jiri Olsa wrote:
> > On Thu, Apr 23, 2020 at 03:51:18PM +0800, Jin, Yao wrote:
> > > Hi Ian,
> > >
> > > On 4/23/2020 2:09 PM, Ian Rogers wrote:
> > > > On Wed, Apr 22, 2020 at 10:54 PM Jin, Yao <yao.jin@xxxxxxxxxxxxxxx> wrote:
> > > > >
> > > > > Hi Jiri,
> > > > >
> > > > > Bisected to this commit which introduced the regression.
> > > > >
> > > > > 26226a97724d ("perf expr: Move expr lexer to flex")
> > > > >
> > > > > Would you like to look at that?
> > > >
> > > > Hi Jin,
> > > >
> > > > that commit breaks parsing of things like ','. See fixes in this patch
> > > > set such as:
> > > > https://lore.kernel.org/lkml/20200422220430.254014-5-irogers@xxxxxxxxxx/
> > > > Fixing the lex issues then exposes other bugs that need to be
> > > > corrected in the json. I've added Fixes to the commit message of:
> > > > https://lore.kernel.org/lkml/20200422220430.254014-3-irogers@xxxxxxxxxx/
> > > > https://lore.kernel.org/lkml/20200422220430.254014-4-irogers@xxxxxxxxxx/
> > > > and would be glad of a review. If we can land:
> > > > https://lore.kernel.org/lkml/20200422220430.254014-12-irogers@xxxxxxxxxx/
> > > > then expr as the source of parse errors can go away :-) The next
> > > > problem is the parse events code, but some of that logic is dependent
> > > > on the machine it is running on. It'd be good to add a test that
> > > > parsed events code can handle the events in metrics too, filtering out
> > > > things like duration_time that are special to metrics.
> > > >
> > > > Thanks,
> > > > Ian
> > > >
> > >
> > > Only with the fix
> > > "https://lore.kernel.org/lkml/20200422220430.254014-5-irogers@xxxxxxxxxx/";
> > > (without other json modifications), the issue was still there.
> > >
> > > localhost:~ # perf stat -M DRAM_Read_Latency
> > > event syntax error:
> > > '../event=0x36,,umask=0x21/,cha/event=0x35,cha_0/event=0x0/}:W,duration_time'
> > > \___ parser error
> > >
> > > Usage: perf stat [<options>] [<command>]
> > >
> > > -M, --metrics <metric/metric group list>
> > > monitor specified metrics or metric groups
> > > (separated by ,)
> >
> > hum, I don't have that metric, is there another example of broken metric?
> >
> > [jolsa@krava perf]$ sudo ./perf stat -M DRAM_Read_Latency
> > Cannot find metric or group `DRAM_Read_Latency'
> >
> > >
> > > So you added other commits which changed the json to let the parse work. But
> > > I don't know if we have to do with this way because it should be a
> > > regression issue.
> > >
> > > In my opinion, we'd better fix the issue in 26226a97724d ("perf expr: Move
> > > expr lexer to flex") and try not to change the json if possible.
> >
> > yea, that change definitely had a potential of breaking things ;-)
> > but it should be easy to fix them
> >
> > I'll go through the v3 of the patchset
>
> ok, there's v2 now ;-)

Fwiw, you can use the test CL without the others and then it should
reproduce the problems. I placed it at the end of the series as
otherwise the test is broken until all the fixes land.

Thanks,
Ian

> jirka
>