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

Like Xu
2022-03-09T06:38:18Z

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.qYNxBFkZ-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=dc889a8974087aba3eb1cc6db2066fbbdb58922a
> 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.

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
>