Re: [PATCH v1 0/9] KVM selftests for s390x

From: Christian Borntraeger
Date: Fri May 24 2019 - 08:32:54 EST




On 24.05.19 14:17, Christian Borntraeger wrote:
>
>
> On 24.05.19 13:11, Christian Borntraeger wrote:
>> I do get
>>
>> [10400.440298] kvm-s390: failed to commit memory region
>> [10400.508723] kvm-s390: failed to commit memory region
>>
>> when running the tests. Will have a look.
>
> It comes from kvm_vm_free. This calls KVM_SET_USER_MEMORY_REGION with size 0,
> which the s390 code does not like.
>

The doc says about KVM_SET_USER_MEMORY_REGION:

This ioctl allows the user to create or modify a guest physical memory
slot. When changing an existing slot, it may be moved in the guest
physical memory space, or its flags may be modified. --> It may not be
resized. <----

$ strace -f -e trace=ioctl tools/testing/selftests/kvm/s390x/sync_regs_test
ioctl(3, KVM_CHECK_EXTENSION, KVM_CAP_SYNC_REGS) = 1
ioctl(4, KVM_CHECK_EXTENSION, KVM_CAP_IMMEDIATE_EXIT) = 1
ioctl(3, KVM_CREATE_VM, 0) = 4
ioctl(4, KVM_SET_USER_MEMORY_REGION, {slot=0, flags=0, guest_phys_addr=0, memory_size=2097152, userspace_addr=0x3ffac500000}) = 0
ioctl(4, KVM_CREATE_VCPU, 5) = 7
ioctl(8, KVM_GET_VCPU_MMAP_SIZE, 0) = 4096
ioctl(8, KVM_GET_VCPU_MMAP_SIZE, 0) = 4096
ioctl(7, KVM_GET_SREGS, 0x3ffef0fdb90) = 0
ioctl(7, KVM_SET_SREGS, 0x3ffef0fdb90) = 0
ioctl(7, KVM_GET_REGS, 0x3ffef0fdcf8) = 0
ioctl(7, KVM_SET_REGS, 0x3ffef0fdcf8) = 0
ioctl(7, KVM_GET_SREGS, 0x3ffef0fdd78) = 0
ioctl(7, KVM_SET_SREGS, 0x3ffef0fdd78) = 0
ioctl(7, KVM_RUN, 0) = 0
ioctl(7, KVM_GET_REGS, 0x3ffef0fdf90) = 0
ioctl(7, KVM_GET_SREGS, 0x3ffef0fe010) = 0
ioctl(7, KVM_RUN, 0) = 0
ioctl(7, KVM_GET_REGS, 0x3ffef0fdf90) = 0
ioctl(7, KVM_GET_SREGS, 0x3ffef0fe010) = 0
ioctl(7, KVM_RUN, 0) = 0
ioctl(4, KVM_SET_USER_MEMORY_REGION, {slot=0, flags=0, guest_phys_addr=0, memory_size=0, userspace_addr=0x3ffac500000}) = 0
+++ exited with 0 +++

So the testcase is wrong? (I think the s390 code is also not fully correct will double check)