Re: [PATCH v4 01/53] perf comm: Use regular mutex

From: Ian Rogers
Date: Mon Nov 27 2023 - 13:59:42 EST


On Sun, Nov 5, 2023 at 7:59 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
>
> On Sun, Nov 5, 2023 at 1:35 PM Ian Rogers <irogers@xxxxxxxxxx> wrote:
> >
> > On Sun, Nov 5, 2023 at 9:32 AM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> > >
> > > Hi Ian,
> > >
> > > On Thu, Nov 2, 2023 at 10:58 AM Ian Rogers <irogers@xxxxxxxxxx> wrote:
> > > >
> > > > The rwsem is only after used for writing so switch to a mutex that has
> > > > better error checking.
> > >
> > > Hmm.. ok. It doesn't make sense to use rwsem without readers.
> > >
> > > >
> > > > Fixes: 7a8f349e9d14 ("perf rwsem: Add debug mode that uses a mutex")
> > >
> > > But I'm not sure this is a fix. Other than that,
> >
> > Thanks Namhyung, it fixes the case that you enable RWS_ERRORCHECK in
> > rwsem.h as the rwsem static initialization is wrong for a mutex.
>
> Sounds like we need a separate fix. Maybe you need to
> add a static initializer macro depending on the config.

Agreed, but the only use would be here and switching this case to a
mutex gives extra error checking such as the mutex being taken
recursively. Given that, I prefer the existing change and the static
initializer for rwsem can be a follow up when needed.

Thanks,
Ian

> Thanks,
> Namhyung