[kvm:kvm-async-pf-int-5.8 3/6] arch/x86/kernel/kvm.c:330:6: warning: Variable 'pa' is reassigned a value before the old one has been used.

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

 



tree:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git kvm-async-pf-int-5.8
head:   62a9576cc07b7dcba951aaa00d6a55933c49367e
commit: b1d405751cd5792856b1b8333aafaca6bf09ccbb [3/6] KVM: x86: Switch KVM guest to using interrupts for page ready APF delivery
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

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


cppcheck warnings: (new ones prefixed by >>)

>> arch/x86/kernel/kvm.c:330:6: warning: Variable 'pa' is reassigned a value before the old one has been used. [redundantAssignment]
     pa = slow_virt_to_phys(this_cpu_ptr(&apf_reason));
        ^
   arch/x86/kernel/kvm.c:326:0: note: Variable 'pa' is reassigned a value before the old one has been used.
     u64 pa = slow_virt_to_phys(this_cpu_ptr(&apf_reason));
   ^
   arch/x86/kernel/kvm.c:330:6: note: Variable 'pa' is reassigned a value before the old one has been used.
     pa = slow_virt_to_phys(this_cpu_ptr(&apf_reason));
        ^

vim +/pa +330 arch/x86/kernel/kvm.c

ab9cf4996bb989 Michael S. Tsirkin 2012-06-24  322  
ed3cf15271fa15 Nicholas Krause    2015-05-20  323  static void kvm_guest_cpu_init(void)
fd10cde9294f73 Gleb Natapov       2010-10-14  324  {
b1d405751cd579 Vitaly Kuznetsov   2020-05-25  325  	if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF_INT) && kvmapf) {
b1d405751cd579 Vitaly Kuznetsov   2020-05-25  326  		u64 pa = slow_virt_to_phys(this_cpu_ptr(&apf_reason));
ef68017eb5704e Andy Lutomirski    2020-02-28  327  
ef68017eb5704e Andy Lutomirski    2020-02-28  328  		WARN_ON_ONCE(!static_branch_likely(&kvm_async_pf_enabled));
ef68017eb5704e Andy Lutomirski    2020-02-28  329  
ef68017eb5704e Andy Lutomirski    2020-02-28 @330  		pa = slow_virt_to_phys(this_cpu_ptr(&apf_reason));
b1d405751cd579 Vitaly Kuznetsov   2020-05-25  331  		pa |= KVM_ASYNC_PF_ENABLED | KVM_ASYNC_PF_DELIVERY_AS_INT;
52a5c155cf79f1 Wanpeng Li         2017-07-13  332  
fe2a3027e74e40 Radim Krčmář       2018-02-01  333  		if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF_VMEXIT))
fe2a3027e74e40 Radim Krčmář       2018-02-01  334  			pa |= KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT;
fe2a3027e74e40 Radim Krčmář       2018-02-01  335  
b1d405751cd579 Vitaly Kuznetsov   2020-05-25  336  		wrmsrl(MSR_KVM_ASYNC_PF_INT, HYPERVISOR_CALLBACK_VECTOR);
b1d405751cd579 Vitaly Kuznetsov   2020-05-25  337  
52a5c155cf79f1 Wanpeng Li         2017-07-13  338  		wrmsrl(MSR_KVM_ASYNC_PF_EN, pa);
89cbc76768c2fa Christoph Lameter  2014-08-17  339  		__this_cpu_write(apf_reason.enabled, 1);
6bca69ada4bc20 Thomas Gleixner    2020-03-07  340  		pr_info("KVM setup async PF for cpu %d\n", smp_processor_id());
fd10cde9294f73 Gleb Natapov       2010-10-14  341  	}
d910f5c1064d7f Glauber Costa      2011-07-11  342  
ab9cf4996bb989 Michael S. Tsirkin 2012-06-24  343  	if (kvm_para_has_feature(KVM_FEATURE_PV_EOI)) {
ab9cf4996bb989 Michael S. Tsirkin 2012-06-24  344  		unsigned long pa;
6bca69ada4bc20 Thomas Gleixner    2020-03-07  345  
ab9cf4996bb989 Michael S. Tsirkin 2012-06-24  346  		/* Size alignment is implied but just to make it explicit. */
ab9cf4996bb989 Michael S. Tsirkin 2012-06-24  347  		BUILD_BUG_ON(__alignof__(kvm_apic_eoi) < 4);
89cbc76768c2fa Christoph Lameter  2014-08-17  348  		__this_cpu_write(kvm_apic_eoi, 0);
89cbc76768c2fa Christoph Lameter  2014-08-17  349  		pa = slow_virt_to_phys(this_cpu_ptr(&kvm_apic_eoi))
5dfd486c4750c9 Dave Hansen        2013-01-22  350  			| KVM_MSR_ENABLED;
ab9cf4996bb989 Michael S. Tsirkin 2012-06-24  351  		wrmsrl(MSR_KVM_PV_EOI_EN, pa);
ab9cf4996bb989 Michael S. Tsirkin 2012-06-24  352  	}
ab9cf4996bb989 Michael S. Tsirkin 2012-06-24  353  
d910f5c1064d7f Glauber Costa      2011-07-11  354  	if (has_steal_clock)
d910f5c1064d7f Glauber Costa      2011-07-11  355  		kvm_register_steal_time();
fd10cde9294f73 Gleb Natapov       2010-10-14  356  }
fd10cde9294f73 Gleb Natapov       2010-10-14  357  

:::::: The code at line 330 was first introduced by commit
:::::: ef68017eb5704eb2b0577c3aa6619e13caf2b59f x86/kvm: Handle async page faults directly through do_page_fault()

:::::: TO: Andy Lutomirski <luto@xxxxxxxxxx>
:::::: CC: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

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



[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