public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yury Norov <ynorov@nvidia.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: david.laight.linux@gmail.com,
	Nathan Chancellor <nathan@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yury Norov <yury.norov@gmail.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>,
	Jani Nikula <jani.nikula@intel.com>,
	Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Kees Cook <keescook@chromium.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH next 12/14] bits: move the defitions of BIT() and BIT_ULL() back to linux/bits.h
Date: Sat, 7 Feb 2026 23:23:47 -0500	[thread overview]
Message-ID: <aYgP00w2xzWfbx8l@yury> (raw)
In-Reply-To: <87cy2gb2ja.ffs@tglx>

On Sat, Feb 07, 2026 at 11:40:41PM +0100, Thomas Gleixner wrote:
> On Wed, Jan 21 2026 at 14:57, david laight linux wrote:
> 
> TLDR: Not going to happen. Period.
> 
> > Move BIT_ULL() and make code that include both headers use the definition
> > of BIT() from linux/bits.h
> > Add BIT_U128() for completness.
> 
> 1) How is that related to $Subject?
> 
> 2) It's clearly documented that patches should not do different things
>    at once.
> 
> 3) It's also documented that stuff is only added when there is a use
>    case. I can't find one.
> 
> > Note that nothing the the x86-64 build relies on the definition in
> > vdso/bits.h, linux/bits.h is always included.
> 
> Wrong. The x86-64 build includes vdso/bits.h for the VDSO build.
> 
> > @@ -2,7 +2,6 @@
> >  #ifndef __LINUX_BITS_H
> >  #define __LINUX_BITS_H
> >  
> > -#include <vdso/bits.h>
> >  #include <uapi/linux/bits.h>
> >  
> >  #define BIT_MASK(nr)		(UL(1) << ((nr) % BITS_PER_LONG))
> > @@ -89,10 +88,16 @@ int BIT_INPUT_CHECK_FAIL(void) __compiletime_error("Bit number out of range");
> >  	((unsigned int)BIT_INPUT_CHECK(+(nr), BITS_PER_TYPE(type)) + ((type)1 << (nr)))
> >  #endif /* defined(__ASSEMBLY__) */
> >  
> > +/* Prefer this definition of BIT() to the one in vdso/bits.h */
> > +#undef BIT
> 
> That's a horrible sloppy hack.
> 
> > +#define __VDSO_BITS_H
> 
> And this even more so.
> 
> > +#define BIT(nr)		BIT_TYPE(unsigned long, nr)
> > +#define BIT_ULL(nr)	BIT_TYPE(unsigned long long, nr)
> 
> Aside of that you sloppily kept the comment above all of this intact,
> which does not make any sense at all after this change. It says:
> 
> /*
>  * Fixed-type variants of BIT(), with additional checks like GENMASK_TYPE(). The
>  * following examples generate compiler warnings due to -Wshift-count-overflow:
>  *
>  * - BIT_U8(8)
>  * - BIT_U32(-1)
>  * - BIT_U32(40)
>  */
> 
> I have to admit that you are at least consistently sloppy.
> 
> >  #define BIT_U8(nr)	BIT_TYPE(u8, nr)
> >  #define BIT_U16(nr)	BIT_TYPE(u16, nr)
> >  #define BIT_U32(nr)	BIT_TYPE(u32, nr)
> >  #define BIT_U64(nr)	BIT_TYPE(u64, nr)
> > +#define BIT_U128(nr)	BIT_TYPE(u128, nr)
> 
> What's wrong with the obvious solution of moving all this BIT_XX() muck
> into vdso/bit.h?
> 
> Especially as you say in your changelog word salad:

I'm next to that. I'm having hard times struggling through this
wording style. As a non-native English speaker, I used to ground
myself when I feel like I can't understand things. But here it's
clearly not only me.

David, for the next iteration, please reword your commit messages and
comments with a more standard version of English.

Regarding this patch, I agree with everything Thomas Gleixner and
Thomas Weißschuh said. This is an NAK.

> > This lets BIT() pick up the extra compile time checks for W=[1c] builds
> > that detect errors like:
> > 	long foo(void) { int x = 64; return BIT(x); }
> > For which clang (silently) just generates a 'return' instruction.
> 
> Letting the VDSO build have the same checks with a W=1 build would be
> too sensible, right?
> 
> It's not rocket science to achieve that. See below.
> 
> That's admittedly a hack too, but a more palatable hack and I'm just
> including it for illustration.
> 
> Just for the record: I definitely spent less time hacking that up than I
> wasted reviewing and replying to your slop.
> 
> The proper thing to do is to move all the stuff which is neither vdso
> nor kernel specific into a separate include/$BIKESHEDTHENAME/ directory
> and sort out that ever recurring problem of VDSO vs. kernel builds once
> and forever. That's not rocket science either.

I would say, "both vdso and kernel", and I would probably add uapi in
the bucket.

Thanks,
Yury

> That'd be too reasonable and tasteful, but not convoluted and sloppy
> enough, right?
> 
> Thanks,
> 
>         tglx

  reply	other threads:[~2026-02-08  4:23 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21 14:57 [PATCH next 00/14] bits: De-bloat expansion of GENMASK() david.laight.linux
2026-01-21 14:57 ` [PATCH next 01/14] overflow: Reduce expansion of __type_max() david.laight.linux
2026-01-21 20:59   ` Kees Cook
2026-02-02 16:45   ` Yury Norov
2026-01-21 14:57 ` [PATCH next 02/14] kbuild: Add W=c for additional compile time checks david.laight.linux
2026-02-02 18:33   ` Yury Norov
2026-02-02 20:07     ` David Laight
2026-02-03  4:47       ` Nathan Chancellor
2026-02-03 11:14         ` David Laight
2026-02-03 19:41       ` Yury Norov
2026-01-21 14:57 ` [PATCH next 03/14] media: videobuf2-core: Use static_assert() for sanity check david.laight.linux
2026-01-21 14:57 ` [PATCH next 04/14] media: atomisp: " david.laight.linux
2026-01-21 14:57 ` [PATCH next 05/14] ixgbevf: Use C test for PAGE_SIZE > IXGBE_MAX_DATA_PER_TXD david.laight.linux
2026-01-23 15:44   ` Simon Horman
2026-01-21 14:57 ` [PATCH next 06/14] asm-generic: include linux/bits.h not vdso/bits.h david.laight.linux
2026-01-21 14:57 ` [PATCH next 07/14] x86/tlb: " david.laight.linux
2026-01-21 14:57 ` [PATCH next 08/14] bits: simplify GENMASK_TYPE() david.laight.linux
2026-02-08  2:36   ` Yury Norov
2026-02-09  9:42     ` David Laight
2026-01-21 14:57 ` [PATCH next 09/14] bits: Change BIT_U8/16() and GENMASK_U8/16() to have unsigned values david.laight.linux
2026-01-21 14:57 ` [PATCH next 10/14] bits: Fix assmebler expansions of GENMASK_Uxx() and BIT_Uxx() david.laight.linux
2026-02-08  3:31   ` Yury Norov
2026-02-08 11:42     ` David Laight
2026-02-08 21:20       ` Yury Norov
2026-02-08 22:27         ` David Laight
2026-01-21 14:57 ` [PATCH next 11/14] bit: Strengthen compile-time tests in GENMASK() and BIT() david.laight.linux
2026-01-21 18:43   ` Vincent Mailhol
2026-01-21 19:14     ` David Laight
2026-01-22  1:11   ` kernel test robot
2026-01-22 10:25     ` David Laight
2026-01-22 20:10       ` David Laight
2026-01-22  4:41   ` kernel test robot
2026-01-22 10:33     ` David Laight
2026-01-22 14:26       ` Andy Shevchenko
2026-01-22 14:55         ` David Laight
2026-01-23  1:25         ` Philip Li
2026-01-23  8:01           ` Vincent Mailhol
2026-01-23  8:11             ` Andy Shevchenko
2026-01-23  8:20               ` Al Viro
2026-01-23  8:24                 ` Andy Shevchenko
2026-01-23  8:32                   ` Vincent Mailhol
2026-01-23  8:46                     ` Andy Shevchenko
2026-01-23  1:24       ` Philip Li
2026-01-21 14:57 ` [PATCH next 12/14] bits: move the defitions of BIT() and BIT_ULL() back to linux/bits.h david.laight.linux
2026-01-21 15:17   ` Thomas Weißschuh
2026-01-21 19:24     ` David Laight
2026-01-22  7:39       ` Thomas Weißschuh
2026-01-22  0:50   ` kernel test robot
2026-01-22  1:23   ` kernel test robot
2026-01-22 10:30     ` David Laight
2026-02-07 22:40   ` Thomas Gleixner
2026-02-08  4:23     ` Yury Norov [this message]
2026-01-21 14:57 ` [PATCH next 13/14] test_bits: Change all the tests to be compile-time tests david.laight.linux
2026-02-08  4:37   ` Yury Norov
2026-02-08 11:32     ` David Laight
2026-01-21 14:57 ` [PATCH next 14/14] test_bits: include some invalid input tests for GENMASK_INPUT_CHECK() david.laight.linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aYgP00w2xzWfbx8l@yury \
    --to=ynorov@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=david.laight.linux@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jani.nikula@intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucas.demarchi@intel.com \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=nathan@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox