linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Naresh Kamboju <naresh.kamboju@linaro.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Yury Norov <yury.norov@gmail.com>
Cc: kernel test robot <lkp@intel.com>,
	llvm@lists.linux.dev, kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	Sean Christopherson <seanjc@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Wanpeng Li <wanpengli@tencent.com>,
	kvm list <kvm@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>, X86 ML <x86@kernel.org>,
	lkft-triage@lists.linaro.org
Subject: Re: [linux-next:master 12308/12886] arch/x86/kvm/hyperv.c:1983:22: warning: shift count >= width of type
Date: Mon, 23 May 2022 07:54:01 +0200	[thread overview]
Message-ID: <3A8C8235-7FC0-4FDF-921A-E53B57096256@redhat.com> (raw)
In-Reply-To: <CA+G9fYtaz2MO_-yxwtqQx+Gxm460mr2S++fFCYAqObacEL1X-Q@mail.gmail.com>

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
>



      reply	other threads:[~2022-05-23  5:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3A8C8235-7FC0-4FDF-921A-E53B57096256@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@redhat.com \
    --cc=naresh.kamboju@linaro.org \
    --cc=nathan@kernel.org \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).