答复: [kvm:queue 182/203] arch/x86/kernel/kvm.c:769:4: error: use of undeclared identifier '__raw_callee_save___kvm_vcpu_is_preempted'

Li,Rongqing
2022-03-09T08:43:55Z

> -----邮件原件-----
> 发件人: Like Xu <like.xu.linux@gmail.com>
> 发送时间: 2022年3月9日 14:38
> 收件人: Li,Rongqing <lirongqing@baidu.com>; Paolo Bonzini
> <pbonzini@redhat.com>
> 抄送: llvm@lists.linux.dev; kbuild-all@lists.01.org; kvm@vger.kernel.org;
> Robert Hu <robert.hu@intel.com>; Farrah Chen <farrah.chen@intel.com>;
> Danmei Wei <danmei.wei@intel.com>; Wang,Guangju
> <wangguangju@baidu.com>; kernel test robot <lkp@intel.com>
> 主题: Re: [kvm:queue 182/203] arch/x86/kernel/kvm.c:769:4: error: use of
> undeclared identifier '__raw_callee_save___kvm_vcpu_is_preempted'
>
> On 9/3/2022 6:18 am, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
> > head: 00a2bd3464280ca1f08e2cbfab22b884ffb731d8
> > commit: dc889a8974087aba3eb1cc6db2066fbbdb58922a [182/203] KVM:
> x86:
> > Support the vCPU preemption check with nopvspin and realtime hint
> > config: x86_64-randconfig-a001
> > (https://download.01.org/0day-ci/archive/20220309/202203090613.qYNxBFk
> > Z-lkp@intel.com/config)
> > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project
> > 0dc66b76fe4c33843755ade391b85ffda0742aeb)
> > 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/virt/kvm/kvm.git/commit/?id=dc889a8974087a
> ba3eb1cc6db2066fbbdb58922a
> > git remote add kvm
> https://git.kernel.org/pub/scm/virt/kvm/kvm.git
> > git fetch --no-tags kvm queue
> > git checkout dc889a8974087aba3eb1cc6db2066fbbdb58922a
> > # save the config file to linux build tree
> > mkdir build_dir
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang
> make.cross
> > W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > All errors (new ones prefixed by >>):
> >
> >>> arch/x86/kernel/kvm.c:769:4: error: use of undeclared identifier
> '__raw_callee_save___kvm_vcpu_is_preempted'
> >
> PV_CALLEE_SAVE(__kvm_vcpu_is_preempted);
> > ^
> > arch/x86/include/asm/paravirt.h:683:35: note: expanded from macro
> 'PV_CALLEE_SAVE'
> > ((struct paravirt_callee_save) { __raw_callee_save_##func })
> > ^
> > <scratch space>:52:1: note: expanded from here
> > __raw_callee_save___kvm_vcpu_is_preempted
> > ^
> > 1 error generated.
>

Sorry, it introduced by my patch, we should move this function out of CONFIG_PARAVIRT_SPINLOCK

I will send a new patch

Thanks

-Li

> How about this fix:
>
> diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
> index 0d76502cc6f5..d656e4117e01 100644
> --- a/arch/x86/include/asm/paravirt.h
> +++ b/arch/x86/include/asm/paravirt.h
> @@ -617,6 +617,7 @@ static __always_inline bool pv_vcpu_is_preempted(long
> cpu)
>
> void __raw_callee_save___native_queued_spin_unlock(struct qspinlock
> *lock);
> bool __raw_callee_save___native_vcpu_is_preempted(long cpu);
> +bool __raw_callee_save___kvm_vcpu_is_preempted(long cpu);
>
> #endif /* SMP && PARAVIRT_SPINLOCKS */
>
> >
> >
> > vim +/__raw_callee_save___kvm_vcpu_is_preempted +769
> > arch/x86/kernel/kvm.c
> >
> > 754
> > 755 static void __init kvm_guest_init(void)
> > 756 {
> > 757 int i;
> > 758
> > 759 paravirt_ops_setup();
> > 760 register_reboot_notifier(&kvm_pv_reboot_nb);
> > 761 for (i = 0; i < KVM_TASK_SLEEP_HASHSIZE; i++)
> > 762 raw_spin_lock_init(&async_pf_sleepers[i].lock);
> > 763
> > 764 if (kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) {
> > 765 has_steal_clock = 1;
> > 766 static_call_update(pv_steal_clock, kvm_steal_clock);
> > 767
> > 768 pv_ops.lock.vcpu_is_preempted =
> > > 769 PV_CALLEE_SAVE(__kvm_vcpu_is_preempted);
> > 770 }
> > 771
> > 772 if (kvm_para_has_feature(KVM_FEATURE_PV_EOI))
> > 773 apic_set_eoi_write(kvm_guest_apic_eoi_write);
> > 774
> > 775 if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF_INT)
> && kvmapf) {
> > 776 static_branch_enable(&kvm_async_pf_enabled);
> > 777 alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
> asm_sysvec_kvm_asyncpf_interrupt);
> > 778 }
> > 779
> >
> > ---
> > 0-DAY CI Kernel Test Service, Intel Corporation
> > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> >