tools headers: Synchronize {uapi/}linux/bits.h with the kernel sources
PATCH 1/1 tools headers: Synchronize {uapi/}linux/bits.h with the kernel sources
tldr; Just FYI, I'm carrying this on the perf tools tree.
Full explanation:
There used to be no copies, with tools/ code using kernel headers directly. From time to time tools/perf/ broke due to legitimate kernel hacking. At some point Linus complained about such direct usage. Then we adopted the current model.
See further details at:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/include/uapi/README
To pick up the changes in this cset:
947697c6f0f75f98 ("uapi: Define GENMASK_U128")
This addresses these perf build warnings:
Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/bits.h include/uapi/linux/bits.h diff -u tools/include/linux/bits.h include/linux/bits.h
Please see tools/include/uapi/README for further details.
--- tools/include/linux/bits.h | 15 +++++++++++++++ tools/include/uapi/linux/bits.h | 3 +++ 2 files changed, 18 insertions(+)
tools/include/linux/bits.h +15 -0
@@ -36,4 +36,19 @@#define GENMASK_ULL (h, l) \ (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l)) +#if !defined(__ASSEMBLY__) +/* +* Missing asm support +* +* __GENMASK_U128() depends on _BIT128() which would not work +* in the asm code, as it shifts an 'unsigned __init128' data +* type instead of direct representation of 128 bit constants +* such as long and unsigned long. The fundamental problem is +* that a 128 bit constant will get silently truncated by the +* gcc compiler. +*/ +#define GENMASK_U128 (h, l) \ + (GENMASK_INPUT_CHECK(h, l) + __GENMASK_U128(h, l)) +#endif +#endif /* __LINUX_BITS_H */
tools/include/uapi/linux/bits.h +3 -0
@@ -12,4 +12,7 @@ (((~_ULL (0 )) - (_ULL (1 ) << (l)) +1 ) & \ (~_ULL(0) >> (__BITS_PER_LONG_LONG - 1 - (h)))) +#define __GENMASK_U128 (h, l) \ + ((_BIT128((h)) << 1) - (_BIT128(l))) +#endif /* _UAPI_LINUX_BITS_H */
Signature · 1 line
2.47.0
Quoted 25 lines · Arnaldo Carvalho de Melo
tldr; Just FYI, I'm carrying this on the perf tools tree.
Full explanation:
There used to be no copies, with
tools/code using kernel headers directly. From time to timetools/perf/broke due to legitimate kernel hacking. At some point Linus complained about such direct usage. Then we adopted the current model.See further details at:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/include/uapi/README
To pick up the changes in this cset:
947697c6f0f75f98("uapi: DefineGENMASK_U128")This addresses these perf build warnings:
Warning: Kernel ABI header differences:
diff -utools/include/uapi/linux/bits.hinclude/uapi/linux/bits.hdiff -utools/include/linux/bits.hinclude/linux/bits.hPlease see
tools/include/uapi/READMEfor further details.
Quoted 9 lines
Cc Adrian Hunter <[email protected]>Cc Anshuman Khandual <[email protected]>Cc Ian Rogers <[email protected]>Cc Jiri Olsa <[email protected]>Cc Kan Liang <[email protected]>Cc Namhyung Kim <[email protected]>Cc Yury Norov <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
Thanks,
Quoted 43 lines
--- tools/include/linux/bits.h | 15 +++++++++++++++ tools/include/uapi/linux/bits.h | 3 +++ 2 files changed, 18 insertions(+)tools/include/linux/bits.h +15
-0@@ -36,4 +36,19 @@#define GENMASK_ULL (h, l) \ (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l)) +#if !defined(__ASSEMBLY__) +/* +* Missing asm support +* +* __GENMASK_U128() depends on _BIT128() which would not work +* in the asm code, as it shifts an 'unsigned __init128' data +* type instead of direct representation of 128 bit constants +* such as long and unsigned long. The fundamental problem is +* that a 128 bit constant will get silently truncated by the +* gcc compiler. +*/ +#define GENMASK_U128 (h, l) \ + (GENMASK_INPUT_CHECK(h, l) + __GENMASK_U128(h, l)) +#endif +#endif /* __LINUX_BITS_H */ tools/include/uapi/linux/bits.h +3
-0@@ -12,4 +12,7 @@ (((~_ULL (0 )) - (_ULL (1 ) << (l)) +1 ) & \ (~_ULL(0) >> (__BITS_PER_LONG_LONG - 1 - (h)))) +#define __GENMASK_U128 (h, l) \ + ((_BIT128((h)) << 1) - (_BIT128(l))) +#endif /* _UAPI_LINUX_BITS_H */ Signature · 1 line
2.47.0