Re: [PATCH v3] perf pmu: Validate raw event with sysfs exported format bits

Jiri Olsa
2021-03-09T21:45:06Z

On Tue, Mar 09, 2021 at 11:00:02AM +0800, Jin, Yao wrote:

SNIP

> > > if (format->value != PERF_PMU_FORMAT_VALUE_CONFIG)
> > > continue;
> > >
> > > Is it right?
> >
> > sure, what I meant was to process only PERF_PMU_FORMAT_VALUE_CONFIG
> > and then call break, because there's no need to iterate further
> >
> > jirka
> >
>
> Sorry, maybe I still misunderstood what you suggested.
>
> My understanding is we still need to iterate the whole formats list even we
> find a PERF_PMU_FORMAT_VALUE_CONFIG.
>
> root@kbl-ppc:/sys/devices/cpu/format# ls
> any cmask edge event frontend in_tx in_tx_cp inv ldlat offcore_rsp pc umask
> root@kbl-ppc:/sys/devices/cpu/format# cat any
> config:21
> root@kbl-ppc:/sys/devices/cpu/format# cat cmask
> config:24-31
> root@kbl-ppc:/sys/devices/cpu/format# cat edge
> config:18
> root@kbl-ppc:/sys/devices/cpu/format# cat edge
> config:18
> root@kbl-ppc:/sys/devices/cpu/format# cat event
> config:0-7
> root@kbl-ppc:/sys/devices/cpu/format# cat frontend
> config1:0-23
> root@kbl-ppc:/sys/devices/cpu/format# cat in_tx_cp
> config:33
> root@kbl-ppc:/sys/devices/cpu/format# cat inv
> config:23
> root@kbl-ppc:/sys/devices/cpu/format# cat ldlat
> config1:0-15
> root@kbl-ppc:/sys/devices/cpu/format# cat offcore_rsp
> config1:0-63
> root@kbl-ppc:/sys/devices/cpu/format# cat pc
> config:19
> root@kbl-ppc:/sys/devices/cpu/format# cat umask
> config:8-15
>
> If we break the loop when we get the first PERF_PMU_FORMAT_VALUE_CONFIG, we
> will only get the format 'any', right?

ugh, yep.. we need all of them ;-) sry

thanks,
jirka