Re: [PATCH RESEND v2] KVM: X86: Implement PV sched yield hypercall

From: Wanpeng Li
Date: Tue May 28 2019 - 02:17:31 EST


On Tue, 28 May 2019 at 14:08, kbuild test robot <lkp@xxxxxxxxx> wrote:
>
> Hi Wanpeng,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on kvm/linux-next]
> [also build test ERROR on v5.2-rc2 next-20190524]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Wanpeng-Li/KVM-X86-Implement-PV-sched-yield-hypercall/20190528-132021
> base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
> config: x86_64-allyesconfig (attached as .config)
> compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>):
>
> arch/x86//kvm/x86.c: In function 'kvm_emulate_hypercall':
> >> arch/x86//kvm/x86.c:7243:7: error: 'KVM_HC_SCHED_YIELD' undeclared (first use in this function); did you mean 'KVM_HC_SEND_IPI'?
> case KVM_HC_SCHED_YIELD:
> ^~~~~~~~~~~~~~~~~~
> KVM_HC_SEND_IPI
> arch/x86//kvm/x86.c:7243:7: note: each undeclared identifier is reported only once for each function it appears in

It's a false report, it is declared in patch 1/3.

>
> vim +7243 arch/x86//kvm/x86.c
>
> 7196
> 7197 int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
> 7198 {
> 7199 unsigned long nr, a0, a1, a2, a3, ret;
> 7200 int op_64_bit;
> 7201
> 7202 if (kvm_hv_hypercall_enabled(vcpu->kvm))
> 7203 return kvm_hv_hypercall(vcpu);
> 7204
> 7205 nr = kvm_rax_read(vcpu);
> 7206 a0 = kvm_rbx_read(vcpu);
> 7207 a1 = kvm_rcx_read(vcpu);
> 7208 a2 = kvm_rdx_read(vcpu);
> 7209 a3 = kvm_rsi_read(vcpu);
> 7210
> 7211 trace_kvm_hypercall(nr, a0, a1, a2, a3);
> 7212
> 7213 op_64_bit = is_64_bit_mode(vcpu);
> 7214 if (!op_64_bit) {
> 7215 nr &= 0xFFFFFFFF;
> 7216 a0 &= 0xFFFFFFFF;
> 7217 a1 &= 0xFFFFFFFF;
> 7218 a2 &= 0xFFFFFFFF;
> 7219 a3 &= 0xFFFFFFFF;
> 7220 }
> 7221
> 7222 if (kvm_x86_ops->get_cpl(vcpu) != 0) {
> 7223 ret = -KVM_EPERM;
> 7224 goto out;
> 7225 }
> 7226
> 7227 switch (nr) {
> 7228 case KVM_HC_VAPIC_POLL_IRQ:
> 7229 ret = 0;
> 7230 break;
> 7231 case KVM_HC_KICK_CPU:
> 7232 kvm_pv_kick_cpu_op(vcpu->kvm, a0, a1);
> 7233 ret = 0;
> 7234 break;
> 7235 #ifdef CONFIG_X86_64
> 7236 case KVM_HC_CLOCK_PAIRING:
> 7237 ret = kvm_pv_clock_pairing(vcpu, a0, a1);
> 7238 break;
> 7239 #endif
> 7240 case KVM_HC_SEND_IPI:
> 7241 ret = kvm_pv_send_ipi(vcpu->kvm, a0, a1, a2, a3, op_64_bit);
> 7242 break;
> > 7243 case KVM_HC_SCHED_YIELD:
> 7244 kvm_sched_yield(vcpu->kvm, a0);
> 7245 ret = 0;
> 7246 break;
> 7247 default:
> 7248 ret = -KVM_ENOSYS;
> 7249 break;
> 7250 }
> 7251 out:
> 7252 if (!op_64_bit)
> 7253 ret = (u32)ret;
> 7254 kvm_rax_write(vcpu, ret);
> 7255
> 7256 ++vcpu->stat.hypercalls;
> 7257 return kvm_skip_emulated_instruction(vcpu);
> 7258 }
> 7259 EXPORT_SYMBOL_GPL(kvm_emulate_hypercall);
> 7260
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation