Hi Syed, Thank you for the patch! Yet something to improve: [auto build test ERROR on 444fc5cde64330661bf59944c43844e7d4c2ccd8] url: https://github.com/0day-ci/linux/commits/Syed-Nayyar-Waris/Introduce-the-for_each_set_clump-macro/20200615-205729 base: 444fc5cde64330661bf59944c43844e7d4c2ccd8 config: x86_64-rhel (attached as .config) compiler: gcc-9 (Debian 9.3.0-13) 9.3.0 reproduce (this is a W=1 build): # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>, old ones prefixed by <<): In file included from include/linux/bits.h:23, from include/linux/bitops.h:5, from include/linux/kernel.h:12, from include/linux/list.h:9, from include/linux/preempt.h:11, from include/linux/hardirq.h:5, from include/linux/kvm_host.h:7, from arch/x86/kvm/../../../virt/kvm/kvm_main.c:18: include/linux/bitmap.h: In function 'bitmap_get_value': >> include/linux/bits.h:26:28: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:590:35: note: in expansion of macro 'GENMASK' 590 | return (map[index] >> offset) & GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bits.h:26:40: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:590:35: note: in expansion of macro 'GENMASK' 590 | return (map[index] >> offset) & GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bitmap.h: In function 'bitmap_set_value': >> include/linux/bits.h:26:28: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:630:11: note: in expansion of macro 'GENMASK' 630 | value &= GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bits.h:26:40: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:630:11: note: in expansion of macro 'GENMASK' 630 | value &= GENMASK(nbits - 1, 0); | ^~~~~~~ cc1: all warnings being treated as errors -- In file included from include/linux/bits.h:23, from include/linux/bitops.h:5, from include/linux/kernel.h:12, from include/linux/list.h:9, from include/linux/preempt.h:11, from include/linux/hardirq.h:5, from include/linux/kvm_host.h:7, from arch/x86/kvm/../../../virt/kvm/irqchip.c:15: include/linux/bitmap.h: In function 'bitmap_get_value': >> include/linux/bits.h:26:28: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:590:35: note: in expansion of macro 'GENMASK' 590 | return (map[index] >> offset) & GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bits.h:26:40: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:590:35: note: in expansion of macro 'GENMASK' 590 | return (map[index] >> offset) & GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bitmap.h: In function 'bitmap_set_value': >> include/linux/bits.h:26:28: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:630:11: note: in expansion of macro 'GENMASK' 630 | value &= GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bits.h:26:40: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:630:11: note: in expansion of macro 'GENMASK' 630 | value &= GENMASK(nbits - 1, 0); | ^~~~~~~ arch/x86/kvm/../../../virt/kvm/irqchip.c: At top level: arch/x86/kvm/../../../virt/kvm/irqchip.c:20:10: fatal error: irq.h: No such file or directory 20 | #include "irq.h" | ^~~~~~~ cc1: all warnings being treated as errors compilation terminated. -- In file included from include/linux/bits.h:23, from include/linux/bitops.h:5, from include/linux/kernel.h:12, from include/linux/list.h:9, from include/linux/preempt.h:11, from include/linux/hardirq.h:5, from include/linux/kvm_host.h:7, from arch/x86/kvm/mmu/page_track.c:14: include/linux/bitmap.h: In function 'bitmap_get_value': >> include/linux/bits.h:26:28: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:590:35: note: in expansion of macro 'GENMASK' 590 | return (map[index] >> offset) & GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bits.h:26:40: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:590:35: note: in expansion of macro 'GENMASK' 590 | return (map[index] >> offset) & GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bitmap.h: In function 'bitmap_set_value': >> include/linux/bits.h:26:28: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:630:11: note: in expansion of macro 'GENMASK' 630 | value &= GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bits.h:26:40: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:630:11: note: in expansion of macro 'GENMASK' 630 | value &= GENMASK(nbits - 1, 0); | ^~~~~~~ arch/x86/kvm/mmu/page_track.c: At top level: arch/x86/kvm/mmu/page_track.c:19:10: fatal error: mmu.h: No such file or directory 19 | #include "mmu.h" | ^~~~~~~ cc1: all warnings being treated as errors compilation terminated. -- In file included from include/linux/bits.h:23, from include/linux/bitops.h:5, from include/linux/kernel.h:12, from include/linux/list.h:9, from include/linux/wait.h:7, from include/linux/wait_bit.h:8, from include/linux/fs.h:6, from include/linux/highmem.h:5, from arch/x86/kvm/vmx/vmx.c:17: include/linux/bitmap.h: In function 'bitmap_get_value': >> include/linux/bits.h:26:28: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:590:35: note: in expansion of macro 'GENMASK' 590 | return (map[index] >> offset) & GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bits.h:26:40: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:590:35: note: in expansion of macro 'GENMASK' 590 | return (map[index] >> offset) & GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bitmap.h: In function 'bitmap_set_value': >> include/linux/bits.h:26:28: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:630:11: note: in expansion of macro 'GENMASK' 630 | value &= GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bits.h:26:40: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:630:11: note: in expansion of macro 'GENMASK' 630 | value &= GENMASK(nbits - 1, 0); | ^~~~~~~ In file included from arch/x86/kvm/vmx/vmx.c:50: arch/x86/kvm/vmx/capabilities.h: At top level: arch/x86/kvm/vmx/capabilities.h:7:10: fatal error: lapic.h: No such file or directory 7 | #include "lapic.h" | ^~~~~~~~~ cc1: all warnings being treated as errors compilation terminated. -- In file included from include/linux/bits.h:23, from include/linux/bitops.h:5, from include/linux/kernel.h:12, from include/linux/list.h:9, from include/linux/preempt.h:11, from include/linux/hardirq.h:5, from include/linux/kvm_host.h:7, from arch/x86/kvm/vmx/pmu_intel.c:12: include/linux/bitmap.h: In function 'bitmap_get_value': >> include/linux/bits.h:26:28: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:590:35: note: in expansion of macro 'GENMASK' 590 | return (map[index] >> offset) & GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bits.h:26:40: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:590:35: note: in expansion of macro 'GENMASK' 590 | return (map[index] >> offset) & GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bitmap.h: In function 'bitmap_set_value': >> include/linux/bits.h:26:28: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:630:11: note: in expansion of macro 'GENMASK' 630 | value &= GENMASK(nbits - 1, 0); | ^~~~~~~ include/linux/bits.h:26:40: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 26 | __builtin_constant_p((l) > (h)), (l) > (h), 0))) | ^ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/bitmap.h:630:11: note: in expansion of macro 'GENMASK' 630 | value &= GENMASK(nbits - 1, 0); | ^~~~~~~ arch/x86/kvm/vmx/pmu_intel.c: At top level: arch/x86/kvm/vmx/pmu_intel.c:15:10: fatal error: x86.h: No such file or directory 15 | #include "x86.h" | ^~~~~~~ cc1: all warnings being treated as errors compilation terminated. .. vim +26 include/linux/bits.h 8bd9cb51daac89 Will Deacon 2018-06-19 15 8bd9cb51daac89 Will Deacon 2018-06-19 16 /* 8bd9cb51daac89 Will Deacon 2018-06-19 17 * Create a contiguous bitmask starting at bit position @l and ending at 8bd9cb51daac89 Will Deacon 2018-06-19 18 * position @h. For example 8bd9cb51daac89 Will Deacon 2018-06-19 19 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. 8bd9cb51daac89 Will Deacon 2018-06-19 20 */ 295bcca84916cb Rikard Falkeborn 2020-04-06 21 #if !defined(__ASSEMBLY__) && \ 295bcca84916cb Rikard Falkeborn 2020-04-06 22 (!defined(CONFIG_CC_IS_GCC) || CONFIG_GCC_VERSION >= 49000) 295bcca84916cb Rikard Falkeborn 2020-04-06 23 #include 295bcca84916cb Rikard Falkeborn 2020-04-06 24 #define GENMASK_INPUT_CHECK(h, l) \ 295bcca84916cb Rikard Falkeborn 2020-04-06 25 (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ 295bcca84916cb Rikard Falkeborn 2020-04-06 @26 __builtin_constant_p((l) > (h)), (l) > (h), 0))) 295bcca84916cb Rikard Falkeborn 2020-04-06 27 #else 295bcca84916cb Rikard Falkeborn 2020-04-06 28 /* 295bcca84916cb Rikard Falkeborn 2020-04-06 29 * BUILD_BUG_ON_ZERO is not available in h files included from asm files, 295bcca84916cb Rikard Falkeborn 2020-04-06 30 * disable the input check if that is the case. 295bcca84916cb Rikard Falkeborn 2020-04-06 31 */ 295bcca84916cb Rikard Falkeborn 2020-04-06 32 #define GENMASK_INPUT_CHECK(h, l) 0 295bcca84916cb Rikard Falkeborn 2020-04-06 33 #endif 295bcca84916cb Rikard Falkeborn 2020-04-06 34 :::::: The code at line 26 was first introduced by commit :::::: 295bcca84916cb5079140a89fccb472bb8d1f6e2 linux/bits.h: add compile time sanity check of GENMASK inputs :::::: TO: Rikard Falkeborn :::::: CC: Linus Torvalds --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org