Re: [PATCH] KVM: x86: Complain about an attempt to change the APIC base address

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

 



Hi Jim,

kernel test robot noticed the following build warnings:

[auto build test WARNING on kvm/queue]
[also build test WARNING on linus/master v6.10-rc5 next-20240625]
[cannot apply to kvm/linux-next]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jim-Mattson/KVM-x86-Complain-about-an-attempt-to-change-the-APIC-base-address/20240625-181629
base:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
patch link:    https://lore.kernel.org/r/20240621224946.4083742-1-jmattson%40google.com
patch subject: [PATCH] KVM: x86: Complain about an attempt to change the APIC base address
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20240626/202406260749.ZqcsICau-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240626/202406260749.ZqcsICau-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406260749.ZqcsICau-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> arch/x86/kvm/lapic.c:2587:8: warning: format specifies type 'unsigned long long' but the argument has type 'unsigned long' [-Wformat]
    2586 |                 vcpu_unimpl(vcpu, "APIC base %#llx is not %#llx",
         |                                              ~~~~~
         |                                              %#lx
    2587 |                             apic->base_address, APIC_DEFAULT_PHYS_BASE);
         |                             ^~~~~~~~~~~~~~~~~~
   include/linux/kvm_host.h:861:44: note: expanded from macro 'vcpu_unimpl'
     860 |         kvm_pr_unimpl("vcpu%i, guest rIP: 0x%lx " fmt,                  \
         |                                                   ~~~
     861 |                         (vcpu)->vcpu_id, kvm_rip_read(vcpu), ## __VA_ARGS__)
         |                                                                 ^~~~~~~~~~~
   include/linux/kvm_host.h:856:33: note: expanded from macro 'kvm_pr_unimpl'
     855 |         pr_err_ratelimited("kvm [%i]: " fmt, \
         |                                         ~~~
     856 |                            task_tgid_nr(current), ## __VA_ARGS__)
         |                                                      ^~~~~~~~~~~
   include/linux/printk.h:672:45: note: expanded from macro 'pr_err_ratelimited'
     672 |         printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |                                            ~~~     ^~~~~~~~~~~
   include/linux/printk.h:658:17: note: expanded from macro 'printk_ratelimited'
     658 |                 printk(fmt, ##__VA_ARGS__);                             \
         |                        ~~~    ^~~~~~~~~~~
   include/linux/printk.h:464:60: note: expanded from macro 'printk'
     464 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
         |                                                     ~~~    ^~~~~~~~~~~
   include/linux/printk.h:436:19: note: expanded from macro 'printk_index_wrap'
     436 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                         ~~~~    ^~~~~~~~~~~
>> arch/x86/kvm/lapic.c:2587:28: warning: format specifies type 'unsigned long long' but the argument has type 'unsigned int' [-Wformat]
    2586 |                 vcpu_unimpl(vcpu, "APIC base %#llx is not %#llx",
         |                                                           ~~~~~
         |                                                           %#x
    2587 |                             apic->base_address, APIC_DEFAULT_PHYS_BASE);
         |                                                 ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/kvm_host.h:861:44: note: expanded from macro 'vcpu_unimpl'
     860 |         kvm_pr_unimpl("vcpu%i, guest rIP: 0x%lx " fmt,                  \
         |                                                   ~~~
     861 |                         (vcpu)->vcpu_id, kvm_rip_read(vcpu), ## __VA_ARGS__)
         |                                                                 ^~~~~~~~~~~
   include/linux/kvm_host.h:856:33: note: expanded from macro 'kvm_pr_unimpl'
     855 |         pr_err_ratelimited("kvm [%i]: " fmt, \
         |                                         ~~~
     856 |                            task_tgid_nr(current), ## __VA_ARGS__)
         |                                                      ^~~~~~~~~~~
   include/linux/printk.h:672:45: note: expanded from macro 'pr_err_ratelimited'
     672 |         printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |                                            ~~~     ^~~~~~~~~~~
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/printk.h:464:60: note: expanded from macro 'printk'
     464 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
         |                                                     ~~~    ^~~~~~~~~~~
   include/linux/printk.h:436:19: note: expanded from macro 'printk_index_wrap'
     436 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                         ~~~~    ^~~~~~~~~~~
   arch/x86/include/asm/apicdef.h:15:33: note: expanded from macro 'APIC_DEFAULT_PHYS_BASE'
      15 | #define APIC_DEFAULT_PHYS_BASE          0xfee00000
         |                                         ^~~~~~~~~~
   2 warnings generated.


vim +2587 arch/x86/kvm/lapic.c

  2542	
  2543	void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
  2544	{
  2545		u64 old_value = vcpu->arch.apic_base;
  2546		struct kvm_lapic *apic = vcpu->arch.apic;
  2547	
  2548		vcpu->arch.apic_base = value;
  2549	
  2550		if ((old_value ^ value) & MSR_IA32_APICBASE_ENABLE)
  2551			kvm_update_cpuid_runtime(vcpu);
  2552	
  2553		if (!apic)
  2554			return;
  2555	
  2556		/* update jump label if enable bit changes */
  2557		if ((old_value ^ value) & MSR_IA32_APICBASE_ENABLE) {
  2558			if (value & MSR_IA32_APICBASE_ENABLE) {
  2559				kvm_apic_set_xapic_id(apic, vcpu->vcpu_id);
  2560				static_branch_slow_dec_deferred(&apic_hw_disabled);
  2561				/* Check if there are APF page ready requests pending */
  2562				kvm_make_request(KVM_REQ_APF_READY, vcpu);
  2563			} else {
  2564				static_branch_inc(&apic_hw_disabled.key);
  2565				atomic_set_release(&apic->vcpu->kvm->arch.apic_map_dirty, DIRTY);
  2566			}
  2567		}
  2568	
  2569		if ((old_value ^ value) & X2APIC_ENABLE) {
  2570			if (value & X2APIC_ENABLE)
  2571				kvm_apic_set_x2apic_id(apic, vcpu->vcpu_id);
  2572			else if (value & MSR_IA32_APICBASE_ENABLE)
  2573				kvm_apic_set_xapic_id(apic, vcpu->vcpu_id);
  2574		}
  2575	
  2576		if ((old_value ^ value) & (MSR_IA32_APICBASE_ENABLE | X2APIC_ENABLE)) {
  2577			kvm_make_request(KVM_REQ_APICV_UPDATE, vcpu);
  2578			static_call_cond(kvm_x86_set_virtual_apic_mode)(vcpu);
  2579		}
  2580	
  2581		apic->base_address = apic->vcpu->arch.apic_base &
  2582				     MSR_IA32_APICBASE_BASE;
  2583	
  2584		if ((value & MSR_IA32_APICBASE_ENABLE) &&
  2585		     apic->base_address != APIC_DEFAULT_PHYS_BASE) {
  2586			vcpu_unimpl(vcpu, "APIC base %#llx is not %#llx",
> 2587				    apic->base_address, APIC_DEFAULT_PHYS_BASE);
  2588			kvm_set_apicv_inhibit(apic->vcpu->kvm,
  2589					      APICV_INHIBIT_REASON_APIC_BASE_MODIFIED);
  2590		}
  2591	}
  2592	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[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