2024-05-21 11:45:58

by John Garry

[permalink] [raw]
Subject: Re: [PATCH v1] perf jevents: Autogenerate empty-pmu-events.c

On 20/05/2024 16:36, Ian Rogers wrote:
> }
> + ret = pmu_events_table__find_event_pmu(table, table_pmu, name, fn, data);
> + if (ret != -1000)
> + return ret;
> + }
> return -1000;

what's -1000 meaning? It would be nice to use some standard error codes.

Thanks,
John




2024-05-21 17:13:33

by Ian Rogers

[permalink] [raw]
Subject: Re: [PATCH v1] perf jevents: Autogenerate empty-pmu-events.c

On Tue, May 21, 2024 at 4:45 AM John Garry <[email protected]> wrote:
>
> On 20/05/2024 16:36, Ian Rogers wrote:
> > }
> > + ret = pmu_events_table__find_event_pmu(table, table_pmu, name, fn, data);
> > + if (ret != -1000)
> > + return ret;
> > + }
> > return -1000;
>
> what's -1000 meaning? It would be nice to use some standard error codes.

This is a pre-existing thing. 0 means continue and anything else
generally aborts a search, -1000 is used when searching multiple
tables to indicate not found in 1 table but potentially not all.

Commit 3d5045492ab2 ("perf pmu-events: Add
pmu_events_table__find_event()") added this [1], you were on the cc
list ;-) I think moving to a named constant would make this more
intention revealing so I'll add this to a v2 set.

Thanks,
Ian

[1] https://lore.kernel.org/r/[email protected]

> Thanks,
> John
>
>