Skip to contentSkip to conversation

bitmap changes for v6.12-rc1

GIT PULL Merged Yury Norov 3 participants 5 messages Sep 27, 2024

lore
Share & tools
lore

Yury Norov

author
#0 lore raw

The following changes since commit de9c2c66ad8e787abec7c9d7eff4f8c3cdd28aed:

Linux 6.11-rc2 (2024-08-04 13:50:53 -0700)

are available in the Git repository at:

https://github.com/norov/linux tags/bitmap-for-6.12

for you to fetch changes up to d7bcc37436c7d373a715d48a7cd74cd3b1724a68:

lib/test_bits.c: Add tests for GENMASK_U128() (2024-08-28 06:54:39 -0700)

----------------------------------------------------------------
bitmap-for-6.12

Hi Linus,

Please pull bitmap changes for v6.12. This request includes:

- switch all bitmamp APIs from inline to __always_inline, from Brian Norris;
- introduce GENMASK_U128() macro, from Anshuman Khandual.

The __always_inline series improves on code generation, and now with the latest compiler versions is required to avoid compilation warnings. It spent enough in my backlog, and I'm thankful to Brian Norris for taking over and moving it forward.

GENMASK_U128() is a prerequisite needed for arm64 development.

Thanks,
Yury

----------------------------------------------------------------
Anshuman Khandual (2):
uapi: Define GENMASK_U128 lib/test_bits.c: Add tests for GENMASK_U128()

Brian Norris (1):
cpumask: Switch from inline to __always_inline

Yury Norov (3):
find: Switch from inline to __always_inline
bitmap: Switch from inline to __always_inline
nodemask: Switch from inline to __always_inline

 include/linux/bitmap.h     | 140 ++++++++++++++++--------------
 include/linux/bits.h       |  15 ++++
 include/linux/cpumask.h    | 212 ++++++++++++++++++++++++---------------------
 include/linux/find.h       |  50 +++++------
 include/linux/nodemask.h   |  86 +++++++++---------
 include/uapi/linux/bits.h  |   3 +
 include/uapi/linux/const.h |  17 ++++
 lib/test_bits.c            |  34 ++++++++
 8 files changed, 325 insertions(+), 232 deletions(-)
#1 lore raw
Quoted 2 lines · Yury Norov

GENMASK_U128() is a prerequisite needed for arm64 development.

Note that at least right now, __int128 is marked as conditional for arm64:

select ARCH_SUPPORTS_INT128 if CC_HAS_INT128

which implies that we may have compiler versions that don't actually support it at all.

That said, I'm not sure what those compiler versions might be. Maybe this is historical copy-and-paste noise.

Linus

author
#2 lore raw
Quoted 6 lines · Linus Torvalds
Quoted 2 lines · Yury Norov

GENMASK_U128() is a prerequisite needed for arm64 development.

Note that at least right now, __int128 is marked as conditional for arm64:

Quoted 7 lines

select ARCH_SUPPORTS_INT128 if CC_HAS_INT128

which implies that we may have compiler versions that don't actually support it at all.

That said, I'm not sure what those compiler versions might be. Maybe this is historical copy-and-paste noise.

Thanks for pointing at this.

So, GCC documentation says that __int128 is an extension, and CC_HAS_INT128 in init/Kconfig tests for it. All existing code that uses 128-bit types is protected with the config you mentioned, or directly with #ifdef __SIZEOF_INT128__. So the GENMASK_U128 should.

I'll drop GENMASK_U128() part from the request and send v2 later today.

Anshuman, can you please make GENMASK_U128() conditional based on CONFIG_ARCH_SUPPORTS_INT128 and resend?

Thanks,
Yury

#3 lore raw
Quoted 2 lines · Yury Norov

I'll drop GENMASK_U128() part from the request and send v2 later today.

I took your pull request, because I _suspect_ the test for CC_HAS_INT128 is historical.

I *think* all the gcc (and clang) versions we support has __int128 support on arm64. It's not a new feature.

That said, I'm not *sure* about it. The fact that we have a test for it in the arm64 Kconfig file may be because we actually have compilers that don't support __int128. Or it might be due to entirely historical reasons.

So my point was just that people who make use of this should really be aware of this worry, and double-check.

GENMASK_U128() is not necessarily wrong. It's just that it's not necessarily available everywhere (it most definitely isn't on most 32-bit targets, for example, but arm64 _may_ be always ok).

Linus