Re: [PATCH] selftests/kvm/x86_64: set rax before vmcall

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

 



Hi Andrei,

On Tue, Jun 28, 2022 at 12:30:11PM -0700, Andrei Vagin wrote:
> kvm_hypercall has to place the hypercall number in rax.
> 
> Trace events show that kvm_pv_test doesn't work properly:
>      kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0
>      kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0
>      kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0
> 
> With this change, it starts working as expected:
>      kvm_pv_test-54285: kvm_hypercall: nr 0x5 a0 0x0 a1 0x0 a2 0x0 a3 0x0
>      kvm_pv_test-54285: kvm_hypercall: nr 0xa a0 0x0 a1 0x0 a2 0x0 a3 0x0
>      kvm_pv_test-54285: kvm_hypercall: nr 0xb a0 0x0 a1 0x0 a2 0x0 a3 0x0
> 
> Signed-off-by: Andrei Vagin <avagin@xxxxxxxxx>
> ---

Good find, this is a rather silly bug. May I suggest the following for
the changelog to better describe the problem (and blame the original
commit):

KVM: selftests: Actually pass function in %rax when calling hypercall

The KVM hypercall ABI requires the caller to pass the hypercall function
number via %rax. Unfortunately, kvm_hypercall() in selftests falls
short and doesn't set the value of %rax.

In turn, trace events show that kvm_pv_test doesn't work properly:

     kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0
     kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0
     kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0

Fix the issue by taking the function number as an input operand to %rax.

Fixes: ac4a4d6de22e ("selftests: kvm: test enforcement of paravirtual cpuid features")

--
Thanks,
Oliver



[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