On 10/11/2023 14.52, Nico Boehr wrote:
Until now, kvm-unit-tests has aligned guests to 1 MB in the host virtual
address space. Unfortunately, some s390x environments require guests to
be 2GB aligned in the host virtual address space, preventing
kvm-unit-tests which act as a hypervisor from running there.
We can't easily put guests at address 0, since we want to be able to run
with MSO/MSL without having to maintain separate page tables for the
guest physical memory. 2GB is also not a good choice, since the
alloc_pages allocator will place its metadata there when the host has
more than 2GB of memory. In addition, we also want a bit of space after
the end of the host physical memory to be able to catch accesses beyond
the end of physical memory.
The vmalloc allocator unfortunately allocates memory starting at the
highest virtual address which is not suitable for guest memory either
due to additional constraints of some environments.
The physical page allocator in memalign_pages() is also not a optimal
choice, since every test running SIE would then require at least 4GB+1MB
of physical memory.
This results in a few quite complex allocation requirements, hence add a
new function sie_guest_alloc() which allocates memory for a guest and
then establishes a properly aligned virtual space mapping.
Rework snippet test and sie tests to use the new sie_guest_alloc()
function.
Reviewed-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20231106170849.1184162-3-nrb@xxxxxxxxxxxxx
Signed-off-by: Nico Boehr <nrb@xxxxxxxxxxxxx>
---
lib/s390x/sie.h | 2 ++
lib/s390x/snippet.h | 9 +++------
lib/s390x/sie.c | 42 ++++++++++++++++++++++++++++++++++++++++++
s390x/sie.c | 4 ++--
4 files changed, 49 insertions(+), 8 deletions(-)
Hi Nico!
a colleague of mine (Jan) told me today that the current SIE-related tests
of the kvm-unit-tests are failing when being run from a KVM guest (i.e. when
we're testing a double-nested scenario). I've bisected the problem and ended
up with this patch here.
Could you please check whether "./run_tests.sh sie mvpg-sie spec_ex-sie"
still works for you from within a KVM guest?
Thanks,
Thomas