Re: [PATCH v1 2/2] perf header: Support hybrid CPU_PMU_CAPS

From: Jiri Olsa
Date: Mon May 10 2021 - 09:15:24 EST


On Thu, May 06, 2021 at 10:43:39PM +0800, Jin, Yao wrote:

SNIP

> > > 'nr of rest pmus', we know that all pmus have been processed.
> > >
> > > Otherwise, we have to continue reading data file till we find something
> > > incorrect and then finally drop the last read data.
> >
> > you have the size of the feature data right? I think we use
> > it in other cases to check if there are more data
> >
>
> The challenge for us is if we need to compatible with the old perf.data
> which was generated by old perf tool.
>
> For the old perf.data, the layout in header is:
>
> nr of caps
> caps string 1
> caps string 2
> ...
> caps string N
>
> It doesn't carry with any other fields such as size of caps data.
>
> To be compatible with old perf.data, so I have to extend the layout to:
>
> nr of caps for pmu 1
> caps string 1
> caps string 2
> ...
> caps string N
> name of pmu 1
> nr of rest pmus
>
> nr of caps for pmu2
> caps string 1
> caps string 2
> ...
> caps string N
> name of pmu 2
> nr of rest pmus
>
> When the new perf tool detects the string such as "cpu_", it can know that
> it's the pmu name field in new perf.data, otherwise it's the old perf.data.

what if the cap string starts with 'cpu_' ?

I think it might be better to create new feature that
stores caps for multiple pmus in generic way

>
> If we add new field such as "size" to the layout, I'm afraid the new perf
> tool can not process the old perf.data correctly.
>
> If we don't need to support old perf.data, that makes things easy.

we need to

jirka