public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
	Sean Christopherson <seanjc@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Shove vp_bitmap handling down into sparse_set_to_vcpu_mask()
Date: Mon, 1 Nov 2021 03:05:43 +0800	[thread overview]
Message-ID: <202111010310.2cZSEhDP-lkp@intel.com> (raw)
In-Reply-To: <20211028213408.2883933-1-seanjc@google.com>

[-- Attachment #1: Type: text/plain, Size: 3865 bytes --]

Hi Sean,

I love your patch! Perhaps something to improve:

[auto build test WARNING on kvm/queue]
[also build test WARNING on next-20211029]
[cannot apply to v5.15-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sean-Christopherson/KVM-x86-Shove-vp_bitmap-handling-down-into-sparse_set_to_vcpu_mask/20211029-053606
base:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
config: x86_64-randconfig-a015-20211031 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 82ed106567063ea269c6d5669278b733e173a42f)
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://github.com/0day-ci/linux/commit/1a2811bcda8f6cc49c4458744e96bdbabc3a38b0
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Sean-Christopherson/KVM-x86-Shove-vp_bitmap-handling-down-into-sparse_set_to_vcpu_mask/20211029-053606
        git checkout 1a2811bcda8f6cc49c4458744e96bdbabc3a38b0
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 

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:1727:6: warning: variable 'bitmap' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (likely(!has_mismatch))
               ^~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:45:21: note: expanded from macro 'likely'
   #  define likely(x)     (__branch_check__(x, 1, __builtin_constant_p(x)))
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/hyperv.c:1730:9: note: uninitialized use occurs here
           memset(bitmap, 0, sizeof(vp_bitmap));
                  ^~~~~~
   arch/x86/kvm/hyperv.c:1727:2: note: remove the 'if' if its condition is always true
           if (likely(!has_mismatch))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/hyperv.c:1721:13: note: initialize the variable 'bitmap' to silence this warning
           u64 *bitmap;
                      ^
                       = NULL
   1 warning generated.


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

  1712	
  1713	static void sparse_set_to_vcpu_mask(struct kvm *kvm, u64 *sparse_banks,
  1714					    u64 valid_bank_mask, unsigned long *vcpu_mask)
  1715	{
  1716		struct kvm_hv *hv = to_kvm_hv(kvm);
  1717		bool has_mismatch = atomic_read(&hv->num_mismatched_vp_indexes);
  1718		u64 vp_bitmap[KVM_HV_MAX_SPARSE_VCPU_SET_BITS];
  1719		struct kvm_vcpu *vcpu;
  1720		int i, bank, sbank = 0;
  1721		u64 *bitmap;
  1722	
  1723		BUILD_BUG_ON(sizeof(vp_bitmap) >
  1724			     sizeof(*vcpu_mask) * BITS_TO_LONGS(KVM_MAX_VCPUS));
  1725	
  1726		/* If vp_index == vcpu_idx for all vCPUs, fill vcpu_mask directly. */
> 1727		if (likely(!has_mismatch))
  1728			bitmap = (u64 *)vcpu_mask;
  1729	
  1730		memset(bitmap, 0, sizeof(vp_bitmap));
  1731		for_each_set_bit(bank, (unsigned long *)&valid_bank_mask,
  1732				 KVM_HV_MAX_SPARSE_VCPU_SET_BITS)
  1733			bitmap[bank] = sparse_banks[sbank++];
  1734	
  1735		if (likely(!has_mismatch))
  1736			return;
  1737	
  1738		bitmap_zero(vcpu_mask, KVM_MAX_VCPUS);
  1739		kvm_for_each_vcpu(i, vcpu, kvm) {
  1740			if (test_bit(kvm_hv_get_vpindex(vcpu), (unsigned long *)vp_bitmap))
  1741				__set_bit(i, vcpu_mask);
  1742		}
  1743	}
  1744	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38981 bytes --]

      parent reply	other threads:[~2021-10-31 19:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 21:34 [PATCH] KVM: x86: Shove vp_bitmap handling down into sparse_set_to_vcpu_mask() Sean Christopherson
2021-10-29 12:56 ` Vitaly Kuznetsov
2021-10-29 14:32   ` Sean Christopherson
2021-10-29 19:06     ` Sean Christopherson
2021-10-29 19:26       ` Sean Christopherson
2021-10-29 19:42         ` Sean Christopherson
2021-10-31 19:05 ` kernel test robot [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=202111010310.2cZSEhDP-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kvm@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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