[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeQzjdo1z8-bKSnMNgxvwTzjypADiBu-NJopia9h-YYLg@mail.gmail.com>
Date: Mon, 11 Dec 2023 22:50:49 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Al Viro <viro@...iv.linux.org.uk>, Greg KH <gregkh@...uxfoundation.org>,
Andrew Morton <akpm@...ux-foundation.org>, tanzirh@...gle.com,
Kees Cook <keescook@...omium.org>, Andy Shevchenko <andy@...nel.org>, linux-hardening@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
Christoph Hellwig <hch@...radead.org>
Subject: Re: [PATCH] lib/string: shrink lib/string.i via IWYU
On Mon, Dec 11, 2023 at 10:48 PM Nick Desaulniers
<ndesaulniers@...gle.com> wrote:
> On Tue, Dec 5, 2023 at 1:44 PM Al Viro <viro@...iv.linux.org.uk> wrote:
> > On Tue, Dec 05, 2023 at 01:39:47PM -0800, Nick Desaulniers wrote:
> >
> > > The tooling Tanzir is working on does wrap IWYU, and does support such
> > > mapping (of 'low level' to 'high level' headers; more so, if it
> > > recommends X you can override to suggest Y instead).
> > >
> > > arch/nios/ also doesn't provide a bug.h, which this patch is
> > > suggesting we include directly. I guess the same goes for
> > > asm/rwonce.h.
> >
> > See include/asm-generic/Kbuild:
> > mandatory-y += bug.h
> > ...
> > mandatory-y += rwonce.h
> >
> > IOW, sh will have asm/bug.h and as/rwonce.h copied from asm-generic.
> >
> > Still, includes of asm/*.h had been a massive headache historically
> > and breeding more of those shouldn't be overdone.
> >
> > More painful problem is arch- and config-dependent stuff, though...
>
> Ah, it looks like include/uapi/asm-generic/Kbuild also makes use of
> this pattern using mandatory-y.
>
> So I think we can handle this as a two step translation. We can tell
> the tooling to 'nevermind recommending X, always replace
> recommendations for X with Y <for raisins>', so:
> 1. any recommendation to use asm-generic/foo.h should be replaced with
> asm/foo.h (always, based on those 2 Kbuild files, could autogenerate)
> 2. some recommendations to use asm/foo.h should be replaced with
> linux/foo.h (not necessarily codified anywhere; depends on if there is
> a linux/foo.h, will manually curate this list for now)
>
> Orthogonal but some places in tree can be cleaned up to include
> linux/foo.h rather than asm/foo.h.
>
> Does this sound like an improvement to my mental model of the
> conventions used for kernel header inclusion within the linux kernel?
>
> Tanzir nearly has the above done (for 1, 2 we will probably need to
> iterate on more). We've also beefed up our local testing to test more
> architectures. I expect Tanzir to send a v2 of this patch (as a
> series, with the fix for ARCH=sh) later this week, if the above seems
> correct.
Whatever you choose, please make sure it gets documented, so we won't
go another round in the future for something similar.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists