Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	 linux-s390@vger.kernel.org, borntraeger@de.ibm.com,
	frankja@linux.ibm.com,  david@kernel.org, seiden@linux.ibm.com,
	nrb@linux.ibm.com,  schlameuss@linux.ibm.com, gra@linux.ibm.com,
	pbonzini@redhat.com,  yan.y.zhao@intel.com,
	isaku.yamahata@intel.com
Subject: Re: [PATCH v1 3/4] KVM: selftests: Fix pre_fault_memory_test to run on s390
Date: Wed, 20 May 2026 08:27:24 -0700	[thread overview]
Message-ID: <ag3S3MjXHW4AeW_6@google.com> (raw)
In-Reply-To: <20260520151710.231788-4-imbrenda@linux.ibm.com>

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@linux.ibm.com>
> ---
>  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.

> +	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
> 

  reply	other threads:[~2026-05-20 15:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20 15:17 [PATCH v1 0/4] KVM: s390: Implement KVM_PRE_FAULT_MEMORY Claudio Imbrenda
2026-05-20 15:17 ` [PATCH v1 1/4] " Claudio Imbrenda
2026-05-20 15:17 ` [PATCH v1 2/4] KVM: s390: Update KVM_PRE_FAULT_MEMORY API documentation Claudio Imbrenda
2026-05-20 15:17 ` [PATCH v1 3/4] KVM: selftests: Fix pre_fault_memory_test to run on s390 Claudio Imbrenda
2026-05-20 15:27   ` Sean Christopherson [this message]
2026-05-20 16:20     ` Claudio Imbrenda
2026-05-20 15:17 ` [PATCH v1 4/4] KVM: selftests: Enable pre_fault_memory_test for s390 Claudio Imbrenda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ag3S3MjXHW4AeW_6@google.com \
    --to=seanjc@google.com \
    --cc=borntraeger@de.ibm.com \
    --cc=david@kernel.org \
    --cc=frankja@linux.ibm.com \
    --cc=gra@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=isaku.yamahata@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=schlameuss@linux.ibm.com \
    --cc=seiden@linux.ibm.com \
    --cc=yan.y.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox