Re: [PATCH] KVM: x86: Shove vp_bitmap handling down into sparse_set_to_vcpu_mask()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

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@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux