Skip to contentSkip to conversation

tools headers: Synchronize linux/bits.h with the kernel sources

tip: perf/core tip-bot2 for Arnaldo Carvalho de Melo 2 participants 2 messages Aug 23, 2019 – Aug 25, 2019 1 message not in the archive Bitmap API

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

tip-bot2 for Arnaldo Carvalho de Melo

author merge bot Applied
#1 lore raw

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     b658911731d41a91b9de5458d6f38d6e1c90a453
Gitweb:        https://git.kernel.org/tip/b658911731d41a91b9de5458d6f38d6e1c90a453
Author:        Arnaldo Carvalho de Melo <[email protected]>
AuthorDate:    Mon, 19 Aug 2019 11:14:28 -03:00
Committer:     Arnaldo Carvalho de Melo <[email protected]>
CommitterDate: Tue, 20 Aug 2019 12:09:21 -03:00

tools headers: Synchronize linux/bits.h with the kernel sources

To pick up the changes in this cset:

95b980d62d52 ("linux/bits.h: make BIT(), GENMASK(), and friends available in assembly")

To address this tools/perf build warning:

Warning: Kernel ABI header at 'tools/include/linux/bits.h' differs from latest version at 'include/linux/bits.h' diff -u tools/include/linux/bits.h include/linux/bits.h

---
 tools/include/linux/bits.h | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
tools/include/linux/bits.h +10 -7
index 2b7b532..669d694 100644
@@ -1,13 +1,15 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef __LINUX_BITS_H
 #define __LINUX_BITS_H
+
+#include <linux/const.h>
 #include <asm/bitsperlong.h>
 
-#define BIT(nr)			(1UL << (nr))
-#define BIT_ULL(nr)		(1ULL << (nr))
-#define BIT_MASK(nr)		(1UL << ((nr) % BITS_PER_LONG))
+#define BIT(nr)			(UL(1) << (nr))
+#define BIT_ULL(nr)		(ULL(1) << (nr))
+#define BIT_MASK(nr)		(UL(1) << ((nr) % BITS_PER_LONG))
 #define BIT_WORD(nr)		((nr) / BITS_PER_LONG)
-#define BIT_ULL_MASK(nr)	(1ULL << ((nr) % BITS_PER_LONG_LONG))
+#define BIT_ULL_MASK(nr)	(ULL(1) << ((nr) % BITS_PER_LONG_LONG))
 #define BIT_ULL_WORD(nr)	((nr) / BITS_PER_LONG_LONG)
 #define BITS_PER_BYTE		8
 
@@ -17,10 +19,11 @@
  * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
  */
 #define GENMASK(h, l) \
-	(((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
+	(((~UL(0)) - (UL(1) << (l)) + 1) & \
+	 (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
 
 #define GENMASK_ULL(h, l) \
-	(((~0ULL) - (1ULL << (l)) + 1) & \
-	 (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
+	(((~ULL(0)) - (ULL(1) << (l)) + 1) & \
+	 (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))
 
 #endif	/* __LINUX_BITS_H */
#2 lore raw
Thank you for the patch! Yet something to improve:

Hi tip-bot2,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc5 next-20190823]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/tip-bot2-for-Arnaldo-Carvalho-de-Melo/tools-headers-Synchronize-linux-bits-h-with-the-kernel-sources/20190826-001511
config: x86_64-randconfig-a004-201934 (attached as .config)
compiler: gcc-6 (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 reproduce:

        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

In file included from tools/include/linux/bitops.h:13:0,

                    from tools/include/linux/hashtable.h:13,
                    from elf.h:12,
                    from check.h:10,
                    from builtin-check.c:18:
   tools/include/asm-generic/bitops/non-atomic.h: In function '__set_bit':
>> tools/include/linux/bits.h:10:24: error: implicit declaration of function 'UL' [-Werror=implicit-function-declaration]
    #define BIT_MASK(nr)  (UL(1) << ((nr) % BITS_PER_LONG))
                           ^
   tools/include/asm-generic/bitops/non-atomic.h:18:23: note: in expansion of macro 'BIT_MASK'
     unsigned long mask = BIT_MASK(nr);
                          ^~~~~~~~
   In file included from tools/include/asm-generic/bitops.h:30:0,
                    from tools/include/linux/bitops.h:32,
                    from tools/include/linux/hashtable.h:13,
                    from elf.h:12,
                    from check.h:10,
                    from builtin-check.c:18:
   tools/include/asm-generic/bitops/non-atomic.h:18:2: error: nested extern declaration of 'UL' [-Werror=nested-externs]
     unsigned long mask = BIT_MASK(nr);
     ^~~~~~~~
   In file included from tools/include/linux/bitops.h:13:0,
                    from tools/include/linux/hashtable.h:13,
                    from elf.h:12,
                    from check.h:10,
                    from builtin-orc.c:17:
   tools/include/asm-generic/bitops/non-atomic.h: In function '__set_bit':
>> tools/include/linux/bits.h:10:24: error: implicit declaration of function 'UL' [-Werror=implicit-function-declaration]
    #define BIT_MASK(nr)  (UL(1) << ((nr) % BITS_PER_LONG))
                           ^
   tools/include/asm-generic/bitops/non-atomic.h:18:23: note: in expansion of macro 'BIT_MASK'
     unsigned long mask = BIT_MASK(nr);
                          ^~~~~~~~
   In file included from tools/include/asm-generic/bitops.h:30:0,
                    from tools/include/linux/bitops.h:32,
                    from tools/include/linux/hashtable.h:13,
                    from elf.h:12,
                    from check.h:10,
                    from builtin-orc.c:17:
   tools/include/asm-generic/bitops/non-atomic.h:18:2: error: nested extern declaration of 'UL' [-Werror=nested-externs]
     unsigned long mask = BIT_MASK(nr);
     ^~~~~~~~
   cc1: all warnings being treated as errors
   In file included from tools/include/linux/bitops.h:13:0,
                    from tools/include/linux/hashtable.h:13,
                    from elf.h:12,
                    from check.h:10,
                    from check.c:10:
   tools/include/asm-generic/bitops/non-atomic.h: In function '__set_bit':
>> tools/include/linux/bits.h:10:24: error: implicit declaration of function 'UL' [-Werror=implicit-function-declaration]
    #define BIT_MASK(nr)  (UL(1) << ((nr) % BITS_PER_LONG))
                           ^
   tools/include/asm-generic/bitops/non-atomic.h:18:23: note: in expansion of macro 'BIT_MASK'
     unsigned long mask = BIT_MASK(nr);
                          ^~~~~~~~
   In file included from tools/include/asm-generic/bitops.h:30:0,
                    from tools/include/linux/bitops.h:32,
                    from tools/include/linux/hashtable.h:13,
                    from elf.h:12,
                    from check.h:10,
                    from check.c:10:
   tools/include/asm-generic/bitops/non-atomic.h:18:2: error: nested extern declaration of 'UL' [-Werror=nested-externs]
     unsigned long mask = BIT_MASK(nr);
     ^~~~~~~~
   In file included from tools/include/linux/bitops.h:13:0,
                    from tools/include/linux/hashtable.h:13,
                    from elf.h:12,
                    from check.h:10,
                    from orc_gen.c:10:
   tools/include/asm-generic/bitops/non-atomic.h: In function '__set_bit':
>> tools/include/linux/bits.h:10:24: error: implicit declaration of function 'UL' [-Werror=implicit-function-declaration]
    #define BIT_MASK(nr)  (UL(1) << ((nr) % BITS_PER_LONG))
                           ^
   tools/include/asm-generic/bitops/non-atomic.h:18:23: note: in expansion of macro 'BIT_MASK'
     unsigned long mask = BIT_MASK(nr);
                          ^~~~~~~~
   In file included from tools/include/asm-generic/bitops.h:30:0,
                    from tools/include/linux/bitops.h:32,
                    from tools/include/linux/hashtable.h:13,
                    from elf.h:12,
                    from check.h:10,
                    from orc_gen.c:10:
   tools/include/asm-generic/bitops/non-atomic.h:18:2: error: nested extern declaration of 'UL' [-Werror=nested-externs]
     unsigned long mask = BIT_MASK(nr);
     ^~~~~~~~
   mv: cannot stat 'tools/objtool/.builtin-check.o.tmp': No such file or directory
   make[4]: *** [tools/objtool/builtin-check.o] Error 1
   In file included from tools/include/linux/bitops.h:13:0,
                    from tools/include/linux/hashtable.h:13,
                    from elf.h:12,
                    from elf.c:19:
   tools/include/asm-generic/bitops/non-atomic.h: In function '__set_bit':
>> tools/include/linux/bits.h:10:24: error: implicit declaration of function 'UL' [-Werror=implicit-function-declaration]
    #define BIT_MASK(nr)  (UL(1) << ((nr) % BITS_PER_LONG))
                           ^
   tools/include/asm-generic/bitops/non-atomic.h:18:23: note: in expansion of macro 'BIT_MASK'
     unsigned long mask = BIT_MASK(nr);
                          ^~~~~~~~
   In file included from tools/include/asm-generic/bitops.h:30:0,
                    from tools/include/linux/bitops.h:32,
                    from tools/include/linux/hashtable.h:13,
                    from elf.h:12,
                    from elf.c:19:
   tools/include/asm-generic/bitops/non-atomic.h:18:2: error: nested extern declaration of 'UL' [-Werror=nested-externs]
     unsigned long mask = BIT_MASK(nr);
     ^~~~~~~~
   In file included from tools/include/linux/bitops.h:13:0,
                    from tools/include/linux/hashtable.h:13,
                    from elf.h:12,
                    from warn.h:14,
                    from orc_dump.c:8:
   tools/include/asm-generic/bitops/non-atomic.h: In function '__set_bit':
>> tools/include/linux/bits.h:10:24: error: implicit declaration of function 'UL' [-Werror=implicit-function-declaration]
    #define BIT_MASK(nr)  (UL(1) << ((nr) % BITS_PER_LONG))
                           ^
   tools/include/asm-generic/bitops/non-atomic.h:18:23: note: in expansion of macro 'BIT_MASK'
     unsigned long mask = BIT_MASK(nr);
                          ^~~~~~~~
   In file included from tools/include/asm-generic/bitops.h:30:0,
                    from tools/include/linux/bitops.h:32,
                    from tools/include/linux/hashtable.h:13,
                    from elf.h:12,
                    from warn.h:14,
                    from orc_dump.c:8:
   tools/include/asm-generic/bitops/non-atomic.h:18:2: error: nested extern declaration of 'UL' [-Werror=nested-externs]
     unsigned long mask = BIT_MASK(nr);
     ^~~~~~~~
   cc1: all warnings being treated as errors
   In file included from tools/include/linux/bitops.h:13:0,
                    from tools/include/linux/hashtable.h:13,
                    from elf.h:12,
                    from special.h:10,
                    from special.c:15:
   tools/include/asm-generic/bitops/non-atomic.h: In function '__set_bit':
>> tools/include/linux/bits.h:10:24: error: implicit declaration of function 'UL' [-Werror=implicit-function-declaration]
    #define BIT_MASK(nr)  (UL(1) << ((nr) % BITS_PER_LONG))
                           ^
   tools/include/asm-generic/bitops/non-atomic.h:18:23: note: in expansion of macro 'BIT_MASK'
     unsigned long mask = BIT_MASK(nr);
                          ^~~~~~~~
   In file included from tools/include/asm-generic/bitops.h:30:0,
                    from tools/include/linux/bitops.h:32,
                    from tools/include/linux/hashtable.h:13,
                    from elf.h:12,
                    from special.h:10,
                    from special.c:15:
   tools/include/asm-generic/bitops/non-atomic.h:18:2: error: nested extern declaration of 'UL' [-Werror=nested-externs]
     unsigned long mask = BIT_MASK(nr);
     ^~~~~~~~
   mv: cannot stat 'tools/objtool/.builtin-orc.o.tmp': No such file or directory
   make[4]: *** [tools/objtool/builtin-orc.o] Error 1
   cc1: all warnings being treated as errors
   In file included from tools/include/linux/bitops.h:13:0,
                    from tools/include/linux/hashtable.h:13,
                    from arch/x86/../../elf.h:12,
                    from arch/x86/decode.c:14:
   tools/include/asm-generic/bitops/non-atomic.h: In function '__set_bit':
>> tools/include/linux/bits.h:10:24: error: implicit declaration of function 'UL' [-Werror=implicit-function-declaration]
    #define BIT_MASK(nr)  (UL(1) << ((nr) % BITS_PER_LONG))
                           ^
   tools/include/asm-generic/bitops/non-atomic.h:18:23: note: in expansion of macro 'BIT_MASK'
     unsigned long mask = BIT_MASK(nr);
                          ^~~~~~~~
   In file included from tools/include/asm-generic/bitops.h:30:0,
                    from tools/include/linux/bitops.h:32,
                    from tools/include/linux/hashtable.h:13,
                    from arch/x86/../../elf.h:12,
                    from arch/x86/decode.c:14:
   tools/include/asm-generic/bitops/non-atomic.h:18:2: error: nested extern declaration of 'UL' [-Werror=nested-externs]
     unsigned long mask = BIT_MASK(nr);
     ^~~~~~~~

mv: cannot stat 'tools/objtool/.special.o.tmp': No such file or directory make[4]: *** [tools/objtool/special.o] Error 1
cc1: all warnings being treated as errors
mv: cannot stat 'tools/objtool/.orc_dump.o.tmp': No such file or directory make[4]: *** [tools/objtool/orc_dump.o] Error 1
cc1: all warnings being treated as errors
mv: cannot stat 'tools/objtool/.orc_gen.o.tmp': No such file or directory make[4]: *** [tools/objtool/orc_gen.o] Error 1
cc1: all warnings being treated as errors
mv: cannot stat 'tools/objtool/.elf.o.tmp': No such file or directory make[4]: *** [tools/objtool/elf.o] Error 1
cc1: all warnings being treated as errors
mv: cannot stat 'tools/objtool/arch/x86/.decode.o.tmp': No such file or directory make[5]: *** [tools/objtool/arch/x86/decode.o] Error 1
make[5]: Target '__build' not remade because of errors.
make[4]: *** [arch/x86] Error 2
cc1: all warnings being treated as errors
mv: cannot stat 'tools/objtool/.check.o.tmp': No such file or directory make[4]: *** [tools/objtool/check.o] Error 1
make[4]: Target '__build' not remade because of errors.
make[3]: *** [tools/objtool/objtool-in.o] Error 2
make[3]: Target 'all' not remade because of errors.
make[2]: *** [objtool] Error 2
make[1]: *** [tools/objtool] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [sub-make] Error 2
34 real 23 user 10 sys 100.03% cpu make prepare

vim +/UL +10 tools/include/linux/bits.h

     7	
     8	#define BIT(nr)			(UL(1) << (nr))
     9	#define BIT_ULL(nr)		(ULL(1) << (nr))
  > 10	#define BIT_MASK(nr)		(UL(1) << ((nr) % BITS_PER_LONG))
    11	#define BIT_WORD(nr)		((nr) / BITS_PER_LONG)
    12	#define BIT_ULL_MASK(nr)	(ULL(1) << ((nr) % BITS_PER_LONG_LONG))
    13	#define BIT_ULL_WORD(nr)	((nr) / BITS_PER_LONG_LONG)
    14	#define BITS_PER_BYTE		8
    15	

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation