Re: [PATCH v4 10/10] KVM: selftests: Move memslot 0 above KVM internal memslots

From: Paolo Bonzini
Date: Fri Jan 24 2020 - 04:01:17 EST


On 23/01/20 19:04, Ben Gardon wrote:
> KVM creates internal memslots between 3 and 4 GiB paddrs on the first
> vCPU creation. If memslot 0 is large enough it collides with these
> memslots an causes vCPU creation to fail. Instead of creating memslot 0
> at paddr 0, start it 4G into the guest physical address space.
>
> Signed-off-by: Ben Gardon <bgardon@xxxxxxxxxx>
> ---
> tools/testing/selftests/kvm/lib/kvm_util.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)

This breaks all tests for me:

$ ./state_test
Testing guest mode: PA-bits:ANY, VA-bits:48, 4K pages
Guest physical address width detected: 46
==== Test Assertion Failure ====
lib/x86_64/processor.c:580: false
pid=4873 tid=4873 - Success
1 0x0000000000409996: addr_gva2gpa at processor.c:579
2 0x0000000000406a38: addr_gva2hva at kvm_util.c:1636
3 0x000000000041036c: kvm_vm_elf_load at elf.c:192
4 0x0000000000409ea9: vm_create_default at processor.c:829
5 0x0000000000400f6f: main at state_test.c:132
6 0x00007f21bdf90494: ?? ??:0
7 0x0000000000401287: _start at ??:?
No mapping for vm virtual address, gva: 0x400000

Memslot 0 should not be too large, so this patch should not be needed.

Paolo