Re: [PATCH v2 6/6] perf cpumap: Add range data encoding

From: Arnaldo Carvalho de Melo
Date: Thu Sep 08 2022 - 14:53:32 EST


Em Wed, Sep 07, 2022 at 03:41:19PM -0700, Ian Rogers escreveu:
> On Thu, Aug 4, 2022 at 12:30 PM Ian Rogers <irogers@xxxxxxxxxx> wrote:
> >
> > On Sun, Jul 31, 2022 at 5:39 AM Jiri Olsa <olsajiri@xxxxxxxxx> wrote:
> > >
> > > On Tue, Jun 14, 2022 at 07:33:53AM -0700, Ian Rogers wrote:
> > >
> > > SNIP
> > >
> > > > + event = cpu_map_data__alloc(&syn_data, sizeof(struct perf_event_header));
> > > > if (!event)
> > > > return NULL;
> > > >
> > > > + syn_data.data = &event->data;
> > > > event->header.type = PERF_RECORD_CPU_MAP;
> > > > - event->header.size = size;
> > > > - event->data.type = type;
> > > > -
> > > > - cpu_map_data__synthesize(&event->data, map, type, max);
> > > > + event->header.size = syn_data.size;
> > > > + cpu_map_data__synthesize(&syn_data);
> > > > return event;
> > > > }
> > > >
> > > > +
> > > > int perf_event__synthesize_cpu_map(struct perf_tool *tool,
> > > > const struct perf_cpu_map *map,
> > > > perf_event__handler_t process,
> > > > @@ -1891,24 +1894,20 @@ int perf_event__synthesize_event_update_name(struct perf_tool *tool, struct evse
> > > > int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, struct evsel *evsel,
> > > > perf_event__handler_t process)
> > > > {
> > > > - size_t size = sizeof(struct perf_event_header) + sizeof(u64) + sizeof(u64);
> > > > + struct synthesize_cpu_map_data syn_data = { .map = evsel->core.own_cpus };
> > > > struct perf_record_event_update *ev;
> > > > - int max, err;
> > > > - u16 type;
> > > > -
> > > > - if (!evsel->core.own_cpus)
> > > > - return 0;
> > >
> > > all seems fine, just looks like we no longer do this check,
> > > might not be needed anymore, as that changed in past
> >
> > This function is called in a test and in this file. The caller already
> > does this test and so the check is redundant plus a little confusing:
> > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/util/synthetic-events.c?h=perf/core#n2062
> > As you say, it wasn't needed any more and so I removed it.
> >
> > Thanks,
> > Ian
>
> Would be nice to land this imo. Anything outstanding?

So the last two patches were outstanding, 5/6 applied cleanly, 6/6 had
some fuzzes, minimal stuff, applied, I'll push it out soon, please
check.

- Arnaldo