Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-15 Thread Al Viro
On Thu, Dec 14, 2023 at 09:04:00PM +, Al Viro wrote: > drivers/firmware/arm_scmi/shmem.c:13:#include Should just use linux/bug.h and be done with that. > drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:10:#include > Completely pointless; not to mention that none of the types de

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-14 Thread Al Viro
On Wed, Dec 06, 2023 at 12:09:17PM +0900, Greg KH wrote: > > slap #include "unaligned.h" into their traps.c and unaligned.c > > (callers and definitions resp.) and strip those from asm/unaligned.h? > > At that point we can remove arch/{arc,parisc}/asm/unaligned.h - everything > > will pick include/

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-11 Thread Andy Shevchenko
On Mon, Dec 11, 2023 at 10:48 PM Nick Desaulniers wrote: > On Tue, Dec 5, 2023 at 1:44 PM Al Viro 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 le

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-11 Thread Nick Desaulniers
On Tue, Dec 5, 2023 at 1:44 PM Al Viro 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

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-07 Thread Andy Shevchenko
On Wed, Dec 06, 2023 at 03:10:46PM +0800, kernel test robot wrote: > Hi, > > kernel test robot noticed the following build errors: > > [auto build test ERROR on 33cc938e65a98f1d29d0a18403dbbee050dcad9a] > > url: > https://github.com/intel-lab-lkp/linux/commits/tanzirh-google-com/lib-string-s

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-07 Thread Andy Shevchenko
On Tue, Dec 05, 2023 at 10:15:21PM +, Al Viro wrote: > On Wed, Dec 06, 2023 at 12:01:56AM +0200, Andy Shevchenko wrote: > > On Tue, Dec 05, 2023 at 01:51:10PM -0800, Nick Desaulniers wrote: > > > On Tue, Dec 5, 2023 at 1:38 PM Al Viro wrote: > > > > On Tue, Dec 05, 2023 at 08:58:53PM +, ta

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-07 Thread Andy Shevchenko
On Tue, Dec 05, 2023 at 02:14:55PM -0800, Nick Desaulniers wrote: > On Tue, Dec 5, 2023 at 1:59 PM Greg KH wrote: ... > For example, lib/math/int_log.c includes asm/bug.h. Is that a case > where lib/math/int_log.c should be #include 'ing linux/bug.h rather > than asm/bug.h? For the C-files it'

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-06 Thread Christoph Hellwig
On Tue, Dec 05, 2023 at 01:39:47PM -0800, Nick Desaulniers wrote: > Hmm...how does one know that linux/bits.h is the higher-level include > of asm/bitsperlong.h? I think this the wrong way of thinking. In general we should always avoid including asm/ headers unless there is no other way. No othe

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread kernel test robot
Hi, kernel test robot noticed the following build errors: [auto build test ERROR on 33cc938e65a98f1d29d0a18403dbbee050dcad9a] url: https://github.com/intel-lab-lkp/linux/commits/tanzirh-google-com/lib-string-shrink-lib-string-i-via-IWYU/20231206-050121 base: 33cc938e65a98f1d29d0a18403dbbee

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Greg KH
On Wed, Dec 06, 2023 at 03:00:47AM +, Al Viro wrote: > On Wed, Dec 06, 2023 at 12:55:42AM +, Al Viro wrote: > > On Wed, Dec 06, 2023 at 08:46:50AM +0900, Greg KH wrote: > > > > > > > > > > But of course, it doesn't always hold true, there are a few minor > > > > > exceptions, but they are r

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Al Viro
On Wed, Dec 06, 2023 at 12:55:42AM +, Al Viro wrote: > On Wed, Dec 06, 2023 at 08:46:50AM +0900, Greg KH wrote: > > > > > > > > But of course, it doesn't always hold true, there are a few minor > > > > exceptions, but they are rare. > > > > > > $ grep -r \\#include lib | grep asm > > > > > >

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Al Viro
On Wed, Dec 06, 2023 at 08:46:50AM +0900, Greg KH wrote: > > > > > > But of course, it doesn't always hold true, there are a few minor > > > exceptions, but they are rare. > > > > $ grep -r \\#include lib | grep asm > > > > shows quite a few exceptions, and just in lib/. > > > > For example, lib

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Greg KH
On Tue, Dec 05, 2023 at 02:14:55PM -0800, Nick Desaulniers wrote: > On Tue, Dec 5, 2023 at 1:59 PM Greg KH wrote: > > > > On Tue, Dec 05, 2023 at 01:51:10PM -0800, Nick Desaulniers wrote: > > > On Tue, Dec 5, 2023 at 1:38 PM Al Viro wrote: > > > > > > > > It also breeds includes of asm/*.h, by th

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Al Viro
On Tue, Dec 05, 2023 at 10:15:21PM +, Al Viro wrote: > It would certainly be nice to have such information in the tree; > "where should I pick $SYMBOL from?" is something one needs to > find out often enough. To a large extent it's covered by "where > in include/*.h do we have it defined?", b

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Nick Desaulniers
On Tue, Dec 5, 2023 at 2:10 PM Randy Dunlap wrote: > > I have an unpublished Linux Best Known Practices txt file with > this "rule" and some other info that I have collected over a few > years. I wouldn't say that it's up to date. Anyway, it's copied below > FWIW. > Generic drivers should not (do

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Nick Desaulniers
On Tue, Dec 5, 2023 at 2:15 PM Al Viro wrote: > > On Wed, Dec 06, 2023 at 12:01:56AM +0200, Andy Shevchenko wrote: > > On Tue, Dec 05, 2023 at 01:51:10PM -0800, Nick Desaulniers wrote: > > > On Tue, Dec 5, 2023 at 1:38 PM Al Viro wrote: > > > > On Tue, Dec 05, 2023 at 08:58:53PM +, tanz...@go

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Al Viro
On Wed, Dec 06, 2023 at 12:01:56AM +0200, Andy Shevchenko wrote: > On Tue, Dec 05, 2023 at 01:51:10PM -0800, Nick Desaulniers wrote: > > On Tue, Dec 5, 2023 at 1:38 PM Al Viro wrote: > > > On Tue, Dec 05, 2023 at 08:58:53PM +, tanz...@google.com wrote: > > ... > > > > > IWYU is implemented u

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Nick Desaulniers
On Tue, Dec 5, 2023 at 1:59 PM Greg KH wrote: > > On Tue, Dec 05, 2023 at 01:51:10PM -0800, Nick Desaulniers wrote: > > On Tue, Dec 5, 2023 at 1:38 PM Al Viro wrote: > > > > > > It also breeds includes of asm/*.h, by the look of the output, which is > > > not a good thing in general ;-/ E.g. #in

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Randy Dunlap
On 12/5/23 14:01, Andy Shevchenko wrote: > On Tue, Dec 05, 2023 at 01:51:10PM -0800, Nick Desaulniers wrote: >> On Tue, Dec 5, 2023 at 1:38 PM Al Viro wrote: >>> On Tue, Dec 05, 2023 at 08:58:53PM +, tanz...@google.com wrote: > > ... > IWYU is implemented using the IWYUScripts github

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Nick Desaulniers
On Tue, Dec 5, 2023 at 1:53 PM Andy Shevchenko wrote: > > Have you checked Ingo Molnar's gigantic series (2k+ patches) for the header > hell clean up? Perhaps we need to apply that first. > We missed you at plumbers. Tanzir gave a talk on this, with the raison d'etre of this work was to see if w

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Andy Shevchenko
+Cc: Jonathan, who tried IWYU with kernel a year or so ago. On Tue, Dec 05, 2023 at 08:58:53PM +, tanz...@google.com wrote: > This diff uses an open source tool include-what-you-use (IWYU) to modify > the include list changing indirect includes to direct includes. > IWYU is implemented using t

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Andy Shevchenko
On Tue, Dec 05, 2023 at 01:51:10PM -0800, Nick Desaulniers wrote: > On Tue, Dec 5, 2023 at 1:38 PM Al Viro wrote: > > On Tue, Dec 05, 2023 at 08:58:53PM +, tanz...@google.com wrote: ... > > > IWYU is implemented using the IWYUScripts github repository which is a > > > tool that is > > > cur

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Greg KH
On Tue, Dec 05, 2023 at 01:51:10PM -0800, Nick Desaulniers wrote: > On Tue, Dec 5, 2023 at 1:38 PM Al Viro wrote: > > > > On Tue, Dec 05, 2023 at 08:58:53PM +, tanz...@google.com wrote: > > > This diff uses an open source tool include-what-you-use (IWYU) to modify > > > the include list changi

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Nick Desaulniers
On Tue, Dec 5, 2023 at 1:44 PM Al Viro 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

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Al Viro
On Tue, Dec 05, 2023 at 09:38:07PM +, Al Viro wrote: > It also breeds includes of asm/*.h, by the look of the output, which is > not a good thing in general ;-/ E.g. #include *anywhere* > outside of linux/uaccess.h is a bad idea. Let me elaborate a bit: Consider e.g. a situation when we ha

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Andy Shevchenko
On Tue, Dec 05, 2023 at 01:39:47PM -0800, Nick Desaulniers wrote: > On Tue, Dec 5, 2023 at 1:24 PM Andrew Morton > wrote: > > On Tue, 5 Dec 2023 13:14:16 -0800 Nick Desaulniers > > wrote: > > > > The preferred way to import bit-fiddling stuff is to include > > > > . Under the hood this may inc

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Nick Desaulniers
On Tue, Dec 5, 2023 at 1:38 PM Al Viro wrote: > > On Tue, Dec 05, 2023 at 08:58:53PM +, tanz...@google.com wrote: > > This diff uses an open source tool include-what-you-use (IWYU) to modify > > the include list changing indirect includes to direct includes. > > How does it account for arch- a

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Andy Shevchenko
On Tue, Dec 05, 2023 at 08:58:53PM +, tanz...@google.com wrote: > This diff uses an open source tool include-what-you-use (IWYU) to modify > the include list changing indirect includes to direct includes. > IWYU is implemented using the IWYUScripts github repository which is a tool > that is >

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Al Viro
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

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Nick Desaulniers
On Tue, Dec 5, 2023 at 1:24 PM Andrew Morton wrote: > > On Tue, 5 Dec 2023 13:14:16 -0800 Nick Desaulniers > wrote: > > > > > > > The preferred way to import bit-fiddling stuff is to include > > > . Under the hood this may include asm/bitsperlong.h. Or > > > it may not, depending on Kconfig se

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Al Viro
On Tue, Dec 05, 2023 at 08:58:53PM +, tanz...@google.com wrote: > This diff uses an open source tool include-what-you-use (IWYU) to modify > the include list changing indirect includes to direct includes. How does it account for arch- and config-dependent indirect includes? In particular, on

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Andrew Morton
On Tue, 5 Dec 2023 13:14:16 -0800 Nick Desaulniers wrote: > > > > The preferred way to import bit-fiddling stuff is to include > > . Under the hood this may include asm/bitsperlong.h. Or > > it may not, depending on Kconfig settings (particularly architecture). > > > > Just triple checking my

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Nick Desaulniers
On Tue, Dec 5, 2023 at 1:04 PM Andrew Morton wrote: > > On Tue, 05 Dec 2023 20:58:53 + tanz...@google.com wrote: > > > This diff uses an open source tool include-what-you-use (IWYU) to modify > > the include list changing indirect includes to direct includes. > > IWYU is implemented using the

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-05 Thread Andrew Morton
On Tue, 05 Dec 2023 20:58:53 + tanz...@google.com wrote: > This diff uses an open source tool include-what-you-use (IWYU) to modify > the include list changing indirect includes to direct includes. > IWYU is implemented using the IWYUScripts github repository which is a tool > that is > curre