Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Jinyu Tang <jinyu.tang@linux.dev>
Cc: Anup Patel <anup@brainfault.org>,
	Anup Patel <apatel@ventanamicro.com>,
	 Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
	 linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	 linux-kselftest@vger.kernel.org, Shuah Khan <shuah@kernel.org>,
	 Atish Patra <atish.patra@linux.dev>,
	Paul Walmsley <pjw@kernel.org>,
	 Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	 Alexandre Ghiti <alex@ghiti.fr>,
	Andrew Jones <andrew.jones@oss.qualcomm.com>,
	 Conor Dooley <conor.dooley@microchip.com>,
	Yong-Xuan Wang <yongxuan.wang@sifive.com>,
	 Nutty Liu <nutty.liu@hotmail.com>, Jinyu Tang <tjytimi@163.com>
Subject: Re: [PATCH 3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V
Date: Tue, 11 Aug 2026 10:18:41 -0700	[thread overview]
Message-ID: <antZcYiOR0WKi5Kv@google.com> (raw)
In-Reply-To: <20260811060134.106973-4-jinyu.tang@linux.dev>

On Tue, Aug 11, 2026, Jinyu Tang wrote:
> RISC-V now supports KVM_PRE_FAULT_MEMORY, so include the generic
> pre_fault_memory_test in the RISC-V KVM selftest build.
> 
> The test uses PAGE_SIZE from the architecture processor header. Define
> the normal 4K RISC-V selftest page size so the generic test can build
> for RISC-V.
> 
> RISC-V selects VM_MODE_DEFAULT at runtime. Initialize the supported
> guest modes before creating the VM so the generic test can run on
> RISC-V hosts where the default mode is discovered from KVM
> capabilities.
> 
> Signed-off-by: Jinyu Tang <jinyu.tang@linux.dev>
> ---

...

> diff --git a/tools/testing/selftests/kvm/pre_fault_memory_test.c b/tools/testing/selftests/kvm/pre_fault_memory_test.c
> index a0fcae3cb7a8..6eebf0524673 100644
> --- a/tools/testing/selftests/kvm/pre_fault_memory_test.c
> +++ b/tools/testing/selftests/kvm/pre_fault_memory_test.c
> @@ -8,6 +8,7 @@
>  #include <linux/sizes.h>
>  
>  #include <test_util.h>
> +#include <guest_modes.h>
>  #include <kvm_util.h>
>  #include <processor.h>
>  #include <pthread.h>
> @@ -219,6 +220,8 @@ static void test_pre_fault_memory(unsigned long vm_type, bool private)
>  
>  int main(int argc, char *argv[])
>  {
> +	guest_modes_append_default();

Can we do this for all selftests in kvm_selftest_init()?  Or perhaps even better,
handle it in kvm_selftest_arch_init() to avoid the gnarly #ifdefs?

Unless there's a meaningful downside to configuring the supported and default
modes, I don't see any reason to force tests to manually do this work.

> +
>  	TEST_REQUIRE(kvm_check_cap(KVM_CAP_PRE_FAULT_MEMORY));
>  
>  	test_pre_fault_memory(0, false);
> -- 
> 2.43.0
> 

      reply	other threads:[~2026-08-11 17:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11  6:01 [PATCH 0/3] KVM: riscv: Add KVM_PRE_FAULT_MEMORY support Jinyu Tang
2026-08-11  6:01 ` [PATCH 1/3] KVM: riscv: Implement KVM_PRE_FAULT_MEMORY Jinyu Tang
2026-08-11  6:01 ` [PATCH 2/3] KVM: selftests: Add RISC-V Sv57 page table indexing Jinyu Tang
2026-08-11  6:01 ` [PATCH 3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V Jinyu Tang
2026-08-11 17:18   ` Sean Christopherson [this message]

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=antZcYiOR0WKi5Kv@google.com \
    --to=seanjc@google.com \
    --cc=alex@ghiti.fr \
    --cc=andrew.jones@oss.qualcomm.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=apatel@ventanamicro.com \
    --cc=atish.patra@linux.dev \
    --cc=conor.dooley@microchip.com \
    --cc=jinyu.tang@linux.dev \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=nutty.liu@hotmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=pjw@kernel.org \
    --cc=shuah@kernel.org \
    --cc=tjytimi@163.com \
    --cc=yongxuan.wang@sifive.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