Re: [PATCH] locking: Detect includes rwlock.h outside of spinlock.h

From: Michael S. Tsirkin
Date: Thu Sep 08 2022 - 02:54:49 EST


On Thu, Sep 08, 2022 at 08:37:38AM +0200, Sebastian Andrzej Siewior wrote:
> On 2022-08-25 18:08:59 [+0200], To linux-kernel@xxxxxxxxxxxxxxx wrote:
> > From: Michael S. Tsirkin <mst@xxxxxxxxxx>
> >
> > The check for __LINUX_SPINLOCK_H within rwlock.h (and other files)
> > detects the direct include of the header file if it is at the very
> > beginning of the include section.
> > If it is listed later then chances are high that spinlock.h was already
> > included (including rwlock.h) and the additional listing of rwlock.h
> > will not cause any failure.
> >
> > On PREEMPT_RT this additional rwlock.h will lead to compile failures
> > since it uses a different rwlock implementation.
> >
> > Add __LINUX_INSIDE_SPINLOCK_H to spinlock.h and check for this instead
> > of __LINUX_SPINLOCK_H to detect wrong includes. This will help detect
> > direct includes of rwlock.h with without PREEMPT_RT enabled.
> >
> > [ bigeasy: add remaining __LINUX_SPINLOCK_H user and rewrite
> > commit description. ]
> >
> > Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> > ---
> >
> > This is to avoid patches like
> > https://lkml.kernel.org/r/20220816074816.173227-1-bigeasy@xxxxxxxxxxxxx
> >
> > in the future which is not the first I sent…
>
> polite *ping*
>
> Sebastian

This needs to be merged by locking maintainers IMHO, not by me.

--
MST