linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 12308/12886] arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type
@ 2022-05-20  8:24 kernel test robot
  2022-05-20 15:48 ` Nathan Chancellor
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2022-05-20  8:24 UTC (permalink / raw)
  To: Yury Norov; +Cc: llvm, kbuild-all, Linux Memory Management List

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   21498d01d045c5b95b93e0a0625ae965b4330ebe
commit: 81db71a60292e9a40ae8f6ef137b17f2aaa15a52 [12308/12886] KVM: x86: hyper-v: replace bitmap_weight() with hweight64()
config: i386-randconfig-a011 (https://download.01.org/0day-ci/archive/20220520/202205201624.A4IhDdYX-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project e00cbbec06c08dc616a0d52a20f678b8fbd4e304)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=81db71a60292e9a40ae8f6ef137b17f2aaa15a52
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 81db71a60292e9a40ae8f6ef137b17f2aaa15a52
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:10:9: note: expanded from macro '__const_hweight8'
            ((!!((w) & (1ULL << 0))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:11:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 1))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:12:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 2))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:13:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 3))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:14:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 4))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:15:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 5))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:16:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 6))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:17:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 7)))))
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:10:9: note: expanded from macro '__const_hweight8'
            ((!!((w) & (1ULL << 0))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:11:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 1))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:12:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 2))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:13:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 3))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:14:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 4))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:15:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 5))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:16:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 6))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:17:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 7)))))
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:73: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                                           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:10:9: note: expanded from macro '__const_hweight8'
            ((!!((w) & (1ULL << 0))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:73: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                                           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:11:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 1))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:73: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                                           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:12:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 2))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:73: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                                           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:13:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 3))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:73: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                                           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:14:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 4))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:73: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                                           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:15:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 5))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:73: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                                           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/asm-generic/bitops/const_hweight.h:16:9: note: expanded from macro '__const_hweight8'
             (!!((w) & (1ULL << 6))) +     \
                  ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   if (hc->var_cnt != hweight64(valid_bank_mask))
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                   ^~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                              ^  ~~
   include/asm-generic/bitops/const_hweight.h:20:73: note: expanded from macro '__const_hweight32'
   #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                                           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)


vim +1983 arch/x86/kvm/hyperv.c

  1934	
  1935	static u64 kvm_hv_send_ipi(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc)
  1936	{
  1937		struct kvm *kvm = vcpu->kvm;
  1938		struct hv_send_ipi_ex send_ipi_ex;
  1939		struct hv_send_ipi send_ipi;
  1940		DECLARE_BITMAP(vcpu_mask, KVM_MAX_VCPUS);
  1941		unsigned long valid_bank_mask;
  1942		u64 sparse_banks[KVM_HV_MAX_SPARSE_VCPU_SET_BITS];
  1943		u32 vector;
  1944		bool all_cpus;
  1945	
  1946		if (hc->code == HVCALL_SEND_IPI) {
  1947			if (!hc->fast) {
  1948				if (unlikely(kvm_read_guest(kvm, hc->ingpa, &send_ipi,
  1949							    sizeof(send_ipi))))
  1950					return HV_STATUS_INVALID_HYPERCALL_INPUT;
  1951				sparse_banks[0] = send_ipi.cpu_mask;
  1952				vector = send_ipi.vector;
  1953			} else {
  1954				/* 'reserved' part of hv_send_ipi should be 0 */
  1955				if (unlikely(hc->ingpa >> 32 != 0))
  1956					return HV_STATUS_INVALID_HYPERCALL_INPUT;
  1957				sparse_banks[0] = hc->outgpa;
  1958				vector = (u32)hc->ingpa;
  1959			}
  1960			all_cpus = false;
  1961			valid_bank_mask = BIT_ULL(0);
  1962	
  1963			trace_kvm_hv_send_ipi(vector, sparse_banks[0]);
  1964		} else {
  1965			if (!hc->fast) {
  1966				if (unlikely(kvm_read_guest(kvm, hc->ingpa, &send_ipi_ex,
  1967							    sizeof(send_ipi_ex))))
  1968					return HV_STATUS_INVALID_HYPERCALL_INPUT;
  1969			} else {
  1970				send_ipi_ex.vector = (u32)hc->ingpa;
  1971				send_ipi_ex.vp_set.format = hc->outgpa;
  1972				send_ipi_ex.vp_set.valid_bank_mask = sse128_lo(hc->xmm[0]);
  1973			}
  1974	
  1975			trace_kvm_hv_send_ipi_ex(send_ipi_ex.vector,
  1976						 send_ipi_ex.vp_set.format,
  1977						 send_ipi_ex.vp_set.valid_bank_mask);
  1978	
  1979			vector = send_ipi_ex.vector;
  1980			valid_bank_mask = send_ipi_ex.vp_set.valid_bank_mask;
  1981			all_cpus = send_ipi_ex.vp_set.format == HV_GENERIC_SET_ALL;
  1982	
> 1983			if (hc->var_cnt != hweight64(valid_bank_mask))
  1984				return HV_STATUS_INVALID_HYPERCALL_INPUT;
  1985	
  1986			if (all_cpus)
  1987				goto check_and_send_ipi;
  1988	
  1989			if (!hc->var_cnt)
  1990				goto ret_success;
  1991	
  1992			if (kvm_get_sparse_vp_set(kvm, hc, 1, sparse_banks,
  1993						  offsetof(struct hv_send_ipi_ex,
  1994							   vp_set.bank_contents)))
  1995				return HV_STATUS_INVALID_HYPERCALL_INPUT;
  1996		}
  1997	
  1998	check_and_send_ipi:
  1999		if ((vector < HV_IPI_LOW_VECTOR) || (vector > HV_IPI_HIGH_VECTOR))
  2000			return HV_STATUS_INVALID_HYPERCALL_INPUT;
  2001	
  2002		if (all_cpus) {
  2003			kvm_send_ipi_to_many(kvm, vector, NULL);
  2004		} else {
  2005			sparse_set_to_vcpu_mask(kvm, sparse_banks, valid_bank_mask, vcpu_mask);
  2006	
  2007			kvm_send_ipi_to_many(kvm, vector, vcpu_mask);
  2008		}
  2009	
  2010	ret_success:
  2011		return HV_STATUS_SUCCESS;
  2012	}
  2013	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 12308/12886] arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type
  2022-05-20  8:24 [linux-next:master 12308/12886] arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type kernel test robot
@ 2022-05-20 15:48 ` Nathan Chancellor
  2022-05-23  5:49   ` Naresh Kamboju
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2022-05-20 15:48 UTC (permalink / raw)
  To: Yury Norov
  Cc: kernel test robot, llvm, kbuild-all, Linux Memory Management List

Hi Yury,

On Fri, May 20, 2022 at 04:24:32PM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   21498d01d045c5b95b93e0a0625ae965b4330ebe
> commit: 81db71a60292e9a40ae8f6ef137b17f2aaa15a52 [12308/12886] KVM: x86: hyper-v: replace bitmap_weight() with hweight64()
> config: i386-randconfig-a011 (https://download.01.org/0day-ci/archive/20220520/202205201624.A4IhDdYX-lkp@intel.com/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project e00cbbec06c08dc616a0d52a20f678b8fbd4e304)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=81db71a60292e9a40ae8f6ef137b17f2aaa15a52
>         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>         git fetch --no-tags linux-next master
>         git checkout 81db71a60292e9a40ae8f6ef137b17f2aaa15a52
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
> >> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
>                    if (hc->var_cnt != hweight64(valid_bank_mask))
>                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
>    #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
>                                                    ^~~~~~~~~~~~~~~~~~~~
>    include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
>    #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
>                                                                               ^  ~~
>    include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
>    #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
>                                                    ^
>    note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
>    include/asm-generic/bitops/const_hweight.h:10:9: note: expanded from macro '__const_hweight8'
>             ((!!((w) & (1ULL << 0))) +     \
>                   ^
>    include/linux/compiler.h:56:47: note: expanded from macro 'if'
>    #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
>                                                  ^~~~
>    include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
>    #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
>                                                       ^~~~

I think this is the proper fix, as valid_bank_mask is only assigned u64
values. Could you fold it into that patch to clear this warning up?

Cheers,
Nathan

diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
index b652b856df2b..e2e95a6fccfd 100644
--- a/arch/x86/kvm/hyperv.c
+++ b/arch/x86/kvm/hyperv.c
@@ -1914,7 +1914,7 @@ static u64 kvm_hv_send_ipi(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc)
 	struct hv_send_ipi_ex send_ipi_ex;
 	struct hv_send_ipi send_ipi;
 	DECLARE_BITMAP(vcpu_mask, KVM_MAX_VCPUS);
-	unsigned long valid_bank_mask;
+	u64 valid_bank_mask;
 	u64 sparse_banks[KVM_HV_MAX_SPARSE_VCPU_SET_BITS];
 	u32 vector;
 	bool all_cpus;


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 12308/12886] arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type
  2022-05-20 15:48 ` Nathan Chancellor
@ 2022-05-23  5:49   ` Naresh Kamboju
  2022-05-23  5:54     ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Naresh Kamboju @ 2022-05-23  5:49 UTC (permalink / raw)
  To: Nathan Chancellor, Vitaly Kuznetsov, Yury Norov
  Cc: kernel test robot, llvm, kbuild-all, Linux Memory Management List,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, Ingo Molnar,
	Jim Mattson, Joerg Roedel, Paolo Bonzini, Sean Christopherson,
	Thomas Gleixner, Wanpeng Li, kvm list, open list, X86 ML,
	lkft-triage

On Fri, 20 May 2022 at 21:18, Nathan Chancellor <nathan@kernel.org> wrote:
>
> Hi Yury,
>
> On Fri, May 20, 2022 at 04:24:32PM +0800, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head:   21498d01d045c5b95b93e0a0625ae965b4330ebe
> > commit: 81db71a60292e9a40ae8f6ef137b17f2aaa15a52 [12308/12886] KVM: x86: hyper-v: replace bitmap_weight() with hweight64()
> > config: i386-randconfig-a011 (https://download.01.org/0day-ci/archive/20220520/202205201624.A4IhDdYX-lkp@intel.com/config)
> > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project e00cbbec06c08dc616a0d52a20f678b8fbd4e304)
> > reproduce (this is a W=1 build):
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=81db71a60292e9a40ae8f6ef137b17f2aaa15a52
> >         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> >         git fetch --no-tags linux-next master
> >         git checkout 81db71a60292e9a40ae8f6ef137b17f2aaa15a52
> >         # save the config file
> >         mkdir build_dir && cp config build_dir/.config
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
> >                    if (hc->var_cnt != hweight64(valid_bank_mask))
> >                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
> >    include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
> >    #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
> >                                                    ^~~~~~~~~~~~~~~~~~~~
> >    include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
> >    #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
> >                                                                               ^  ~~
> >    include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
> >    #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
> >                                                    ^
> >    note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
> >    include/asm-generic/bitops/const_hweight.h:10:9: note: expanded from macro '__const_hweight8'
> >             ((!!((w) & (1ULL << 0))) +     \
> >                   ^
> >    include/linux/compiler.h:56:47: note: expanded from macro 'if'
> >    #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
> >                                                  ^~~~
> >    include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
> >    #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
> >                                                       ^~~~

LKFT build system found these build warnings / errors on Linux next-20220520.

> I think this is the proper fix, as valid_bank_mask is only assigned u64
> values. Could you fold it into that patch to clear this warning up?

The proposed patch below was tested and it fixed the reported problem on 32-bit

> Cheers,
> Nathan
>
> diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
> index b652b856df2b..e2e95a6fccfd 100644
> --- a/arch/x86/kvm/hyperv.c
> +++ b/arch/x86/kvm/hyperv.c
> @@ -1914,7 +1914,7 @@ static u64 kvm_hv_send_ipi(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc)
>         struct hv_send_ipi_ex send_ipi_ex;
>         struct hv_send_ipi send_ipi;
>         DECLARE_BITMAP(vcpu_mask, KVM_MAX_VCPUS);
> -       unsigned long valid_bank_mask;
> +       u64 valid_bank_mask;
>         u64 sparse_banks[KVM_HV_MAX_SPARSE_VCPU_SET_BITS];
>         u32 vector;
>         bool all_cpus;

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>

--
Linaro LKFT
https://lkft.linaro.org


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 12308/12886] arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type
  2022-05-23  5:49   ` Naresh Kamboju
@ 2022-05-23  5:54     ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2022-05-23  5:54 UTC (permalink / raw)
  To: Naresh Kamboju, Nathan Chancellor, Vitaly Kuznetsov, Yury Norov
  Cc: kernel test robot, llvm, kbuild-all, Linux Memory Management List,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, Ingo Molnar,
	Jim Mattson, Joerg Roedel, Sean Christopherson, Thomas Gleixner,
	Wanpeng Li, kvm list, open list, X86 ML, lkft-triage

The patch is already merged in 5.18.

Paolo


Il 23 maggio 2022 07:49:42 CEST, Naresh Kamboju <naresh.kamboju@linaro.org> ha scritto:
>On Fri, 20 May 2022 at 21:18, Nathan Chancellor <nathan@kernel.org> wrote:
>>
>> Hi Yury,
>>
>> On Fri, May 20, 2022 at 04:24:32PM +0800, kernel test robot wrote:
>> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
>> > head:   21498d01d045c5b95b93e0a0625ae965b4330ebe
>> > commit: 81db71a60292e9a40ae8f6ef137b17f2aaa15a52 [12308/12886] KVM: x86: hyper-v: replace bitmap_weight() with hweight64()
>> > config: i386-randconfig-a011 (https://download.01.org/0day-ci/archive/20220520/202205201624.A4IhDdYX-lkp@intel.com/config)
>> > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project e00cbbec06c08dc616a0d52a20f678b8fbd4e304)
>> > reproduce (this is a W=1 build):
>> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>> >         chmod +x ~/bin/make.cross
>> >         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=81db71a60292e9a40ae8f6ef137b17f2aaa15a52
>> >         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>> >         git fetch --no-tags linux-next master
>> >         git checkout 81db71a60292e9a40ae8f6ef137b17f2aaa15a52
>> >         # save the config file
>> >         mkdir build_dir && cp config build_dir/.config
>> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
>> >
>> > If you fix the issue, kindly add following tag as appropriate
>> > Reported-by: kernel test robot <lkp@intel.com>
>> >
>> > All warnings (new ones prefixed by >>):
>> >
>> > >> arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type [-Wshift-count-overflow]
>> >                    if (hc->var_cnt != hweight64(valid_bank_mask))
>> >                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> >    include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
>> >    #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
>> >                                                    ^~~~~~~~~~~~~~~~~~~~
>> >    include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
>> >    #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
>> >                                                                               ^  ~~
>> >    include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
>> >    #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
>> >                                                    ^
>> >    note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
>> >    include/asm-generic/bitops/const_hweight.h:10:9: note: expanded from macro '__const_hweight8'
>> >             ((!!((w) & (1ULL << 0))) +     \
>> >                   ^
>> >    include/linux/compiler.h:56:47: note: expanded from macro 'if'
>> >    #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
>> >                                                  ^~~~
>> >    include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
>> >    #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
>> >                                                       ^~~~
>
>LKFT build system found these build warnings / errors on Linux next-20220520.
>
>> I think this is the proper fix, as valid_bank_mask is only assigned u64
>> values. Could you fold it into that patch to clear this warning up?
>
>The proposed patch below was tested and it fixed the reported problem on 32-bit
>
>> Cheers,
>> Nathan
>>
>> diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
>> index b652b856df2b..e2e95a6fccfd 100644
>> --- a/arch/x86/kvm/hyperv.c
>> +++ b/arch/x86/kvm/hyperv.c
>> @@ -1914,7 +1914,7 @@ static u64 kvm_hv_send_ipi(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc)
>>         struct hv_send_ipi_ex send_ipi_ex;
>>         struct hv_send_ipi send_ipi;
>>         DECLARE_BITMAP(vcpu_mask, KVM_MAX_VCPUS);
>> -       unsigned long valid_bank_mask;
>> +       u64 valid_bank_mask;
>>         u64 sparse_banks[KVM_HV_MAX_SPARSE_VCPU_SET_BITS];
>>         u32 vector;
>>         bool all_cpus;
>
>Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
>Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
>
>--
>Linaro LKFT
>https://lkft.linaro.org
>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-23  5:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-20  8:24 [linux-next:master 12308/12886] arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type kernel test robot
2022-05-20 15:48 ` Nathan Chancellor
2022-05-23  5:49   ` Naresh Kamboju
2022-05-23  5:54     ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).