Re: [PATCH v1] perf test expr: Fix system_tsc_freq for only x86

From: Ian Rogers
Date: Thu Dec 05 2024 - 02:10:14 EST


On Wed, Dec 4, 2024 at 10:33 PM Ian Rogers <irogers@xxxxxxxxxx> wrote:
>
> On Wed, Dec 4, 2024 at 9:47 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> >
> > Hi Ian,
> >
> > On Wed, Dec 04, 2024 at 06:23:05PM -0800, Ian Rogers wrote:
> > > The refactoring of tool PMU events to have a PMU then adding the expr
> > > literals to the tool PMU made it so that the literal system_tsc_freq
> > > was only supported on x86. Update the test expectations to match -
> > > namely the parsing is x86 specific and only yields a non-zero value on
> > > Intel.
> > >
> > > Fixes: 609aa2667f67 ("perf tool_pmu: Switch to standard pmu functions and json descriptions")
> > > Reported-by: Athira Rajeev <atrajeev@xxxxxxxxxxxxxxxxxx>
> > > Closes: https://lore.kernel.org/linux-perf-users/20241022140156.98854-1-atrajeev@xxxxxxxxxxxxxxxxxx/
> > > Co-developed-by: Athira Rajeev <atrajeev@xxxxxxxxxxxxxxxxxx>
> > > Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
> >
> > It failed on my VM.
> >
> > root@arm64-vm:~/build# ./perf test -v 7
> > --- start ---
> > test child forked, pid 2096
> > Using CPUID 0x00000000000f0510
> > division by zero
> > syntax error
> > Unrecognized literal '#system_tsc_freq'FAILED tests/expr.c:253 #system_tsc_freq == 0
> > ---- end(-1) ----
> > 7: Simple expression parser : FAILED!
>
> I'll need to check this. The test is looking for parsing failures, so
> it's confusing to me expr__parse is returning 0. I was testing on x86
> but disabling the literal in the tool PMU.

Hmm.. perhaps you had a similar issue to me and that b4 silently
failed as git user.email/user.name weren't configured? When I test on
a raspberry pi 5:
```
$ uname -a
Linux raspberrypi 6.6.51+rpt-rpi-2712 #1 SMP PREEMPT Debian
1:6.6.51-1+rpt3 (2024-10-08) aarch64 GNU/Linux
$ git log -1 --oneline
94733a0e50fd (HEAD -> ptn-expr-test) perf test expr: Fix
system_tsc_freq for only x86
$ /tmp/perf/perf test expr -v
Couldn't bump rlimit(MEMLOCK), failures may take place when creating
BPF maps, etc
7: Simple expression parser : Ok
```

Thanks,
Ian