Re: [PATCH v1 3/4] KVM: selftests: Fix pre_fault_memory_test to run on s390

From: Claudio Imbrenda

Date: Wed May 20 2026 - 13:18:30 EST


On Wed, 20 May 2026 08:27:24 -0700
Sean Christopherson <seanjc@xxxxxxxxxx> wrote:

> On Wed, May 20, 2026, Claudio Imbrenda wrote:
> > Add a missing #include <ucall_common.h> which is needed and otherwise
> > not included on s390.
> >
> > Fence the assertion vcpu->run->exit_reason == KVM_EXIT_IO so that it
> > is only checked on x86. On s390 the UCALL will return with a different
> > code.
> >
> > Signed-off-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
> > ---
> > tools/testing/selftests/kvm/pre_fault_memory_test.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/testing/selftests/kvm/pre_fault_memory_test.c b/tools/testing/selftests/kvm/pre_fault_memory_test.c
> > index fcb57fd034e6..42794892e902 100644
> > --- a/tools/testing/selftests/kvm/pre_fault_memory_test.c
> > +++ b/tools/testing/selftests/kvm/pre_fault_memory_test.c
> > @@ -11,6 +11,7 @@
> > #include <kvm_util.h>
> > #include <processor.h>
> > #include <pthread.h>
> > +#include <ucall_common.h>
> >
> > /* Arbitrarily chosen values */
> > #define TEST_SIZE (SZ_2M + PAGE_SIZE)
> > @@ -167,7 +168,6 @@ static void __test_pre_fault_memory(unsigned long vm_type, bool private)
> > .type = vm_type,
> > };
> > struct kvm_vcpu *vcpu;
> > - struct kvm_run *run;
> > struct kvm_vm *vm;
> > struct ucall uc;
> >
> > @@ -193,10 +193,11 @@ static void __test_pre_fault_memory(unsigned long vm_type, bool private)
> > vcpu_args_set(vcpu, 1, gva);
> > vcpu_run(vcpu);
> >
> > - run = vcpu->run;
> > - TEST_ASSERT(run->exit_reason == KVM_EXIT_IO,
> > +#ifdef __x86_64__
>
> I'd say just delete this assertion entirely. It's an extra layer of paranoia to
> guard against stale ucall data, but x86's ucall_arch_get_ucall() already has
> sufficient guards.

will do, thanks!

>
> > + TEST_ASSERT(vcpu->run->exit_reason == KVM_EXIT_IO,
> > "Wanted KVM_EXIT_IO, got exit reason: %u (%s)",
> > run->exit_reason, exit_reason_str(run->exit_reason));
> > +#endif
> >
> > switch (get_ucall(vcpu, &uc)) {
> > case UCALL_ABORT:
> > --
> > 2.54.0
> >