Re: [PATCH v3 1/8] perf bpf-filter: Make filters map a single entry hashmap

From: Namhyung Kim
Date: Thu Jul 25 2024 - 21:41:17 EST


On Wed, Jul 24, 2024 at 06:39:34PM -0300, Arnaldo Carvalho de Melo wrote:
> On Wed, Jul 24, 2024 at 01:20:27PM -0700, Namhyung Kim wrote:
> > On Wed, Jul 24, 2024 at 04:32:16PM -0300, Arnaldo Carvalho de Melo wrote:
> > > On Wed, Jul 03, 2024 at 03:30:28PM -0700, Namhyung Kim wrote:
> > > > And the value is now an array. This is to support multiple filter
> > > > entries in the map later.
> > > >
> > > > No functional changes intended.
> > >
> > > Hey how can we test this feature these days?
> >
> > There's a 'perf record sample filtering (by BPF) tests'.
> >
> > $ ./perf test -vv filtering
> > 95: perf record sample filtering (by BPF) tests:
> > --- start ---
> > test child forked, pid 1042594
> > Checking BPF-filter privilege
> > try 'sudo perf record --setup-filter pin' first.
> > bpf-filter test [Skipped permission]
> > ---- end(-2) ----
> > 95: perf record sample filtering (by BPF) tests : Skip
> >
> > >
> > > With this first patch applied:
> > >
> > > root@number:~# perf record -a -W -e cycles:p --filter 'period > 100 || weight > 0' sleep 1
> > > Error: cpu_atom/cycles/p event does not have PERF_SAMPLE_WEIGHT
> > > Hint: please add -W option to perf record
> > > failed to set filter "BPF" on event cpu_atom/cycles/p with 95 (Operation not supported)
> > > root@number:~# perf record -a -W -e cpu_core/cycles/p --filter 'period > 100 || weight > 0' sleep 1
> > > Error: cpu_core/cycles/p event does not have PERF_SAMPLE_WEIGHT
> > > Hint: please add -W option to perf record
> > > failed to set filter "BPF" on event cpu_core/cycles/p with 95 (Operation not supported)
> > > root@number:~# perf record -a -W -e cpu_atom/cycles/p --filter 'period > 100 || weight > 0' sleep 1
> > > Error: cpu_atom/cycles/p event does not have PERF_SAMPLE_WEIGHT
> > > Hint: please add -W option to perf record
> > > failed to set filter "BPF" on event cpu_atom/cycles/p with 95 (Operation not supported)
> > > root@number:~#
> >
> > Do you say it's failing after the first patch? It looks like the atom
>
> yes
>
> > CPU doesn't support PERF_SAMPLE_WEIGHT and should fail already.
>
> I tried with 'cycles:p', 'cpu_atom/cycles/p' and with
> 'cpu_core/cycles/p', with and without -W (to use the warning advice)
> will try again tomorrow.

Let me know if you find anything. Maybe it didn't set the flag in the
attr. Can you run `perf record -W true && perf evlist -v` ?

Thanks,
Namhyung