linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] KVM: riscv: selftests: Enable supported test cases
@ 2025-08-07 14:59 dayss1224
  2025-08-07 14:59 ` [PATCH v2 1/3] KVM: riscv: selftests: Add common " dayss1224
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: dayss1224 @ 2025-08-07 14:59 UTC (permalink / raw)
  To: kvm, linux-kselftest, linux-kernel, kvm-riscv, linux-riscv
  Cc: Paolo Bonzini, Shuah Khan, Anup Patel, Atish Patra, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Mathieu Desnoyers,
	Peter Zijlstra, Paul E. McKenney, Boqun Feng, Dong Yang

From: Dong Yang <dayss1224@gmail.com>

Add supported KVM test cases and fix the compilation dependencies.
---
Changes in v2:
- Delete some repeat KVM test cases on riscv
- Add missing headers to fix the build for new RISC-V KVM selftests

Dong Yang (1):
  KVM: riscv: selftests: Add missing headers for new testcases

Quan Zhou (2):
  KVM: riscv: selftests: Add common supported test cases
  KVM: riscv: selftests: Use the existing RISCV_FENCE macro in
    `rseq-riscv.h`

 tools/testing/selftests/kvm/Makefile.kvm              | 6 ++++++
 tools/testing/selftests/kvm/include/riscv/processor.h | 2 ++
 tools/testing/selftests/rseq/rseq-riscv.h             | 3 +--
 3 files changed, 9 insertions(+), 2 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/3] KVM: riscv: selftests: Add common supported test cases
  2025-08-07 14:59 [PATCH v2 0/3] KVM: riscv: selftests: Enable supported test cases dayss1224
@ 2025-08-07 14:59 ` dayss1224
  2025-08-19  0:20   ` Andrew Jones
  2025-08-07 14:59 ` [PATCH v2 2/3] KVM: riscv: selftests: Use the existing RISCV_FENCE macro in `rseq-riscv.h` dayss1224
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: dayss1224 @ 2025-08-07 14:59 UTC (permalink / raw)
  To: kvm, linux-kselftest, linux-kernel, kvm-riscv, linux-riscv
  Cc: Paolo Bonzini, Shuah Khan, Anup Patel, Atish Patra, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Mathieu Desnoyers,
	Peter Zijlstra, Paul E. McKenney, Boqun Feng, Quan Zhou,
	Dong Yang

From: Quan Zhou <zhouquan@iscas.ac.cn>

Some common KVM test cases are supported on riscv now as following:

    access_tracking_perf_test
    dirty_log_perf_test
    memslot_modification_stress_test
    memslot_perf_test
    mmu_stress_test
    rseq_test

Signed-off-by: Quan Zhou <zhouquan@iscas.ac.cn>
Signed-off-by: Dong Yang <dayss1224@gmail.com>
---
 tools/testing/selftests/kvm/Makefile.kvm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/testing/selftests/kvm/Makefile.kvm b/tools/testing/selftests/kvm/Makefile.kvm
index 38b95998e..3a7186551 100644
--- a/tools/testing/selftests/kvm/Makefile.kvm
+++ b/tools/testing/selftests/kvm/Makefile.kvm
@@ -197,6 +197,12 @@ TEST_GEN_PROGS_riscv += arch_timer
 TEST_GEN_PROGS_riscv += coalesced_io_test
 TEST_GEN_PROGS_riscv += get-reg-list
 TEST_GEN_PROGS_riscv += steal_time
+TEST_GEN_PROGS_riscv += access_tracking_perf_test
+TEST_GEN_PROGS_riscv += dirty_log_perf_test
+TEST_GEN_PROGS_riscv += memslot_modification_stress_test
+TEST_GEN_PROGS_riscv += memslot_perf_test
+TEST_GEN_PROGS_riscv += mmu_stress_test
+TEST_GEN_PROGS_riscv += rseq_test
 
 TEST_GEN_PROGS_loongarch += coalesced_io_test
 TEST_GEN_PROGS_loongarch += demand_paging_test
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/3] KVM: riscv: selftests: Use the existing RISCV_FENCE macro in `rseq-riscv.h`
  2025-08-07 14:59 [PATCH v2 0/3] KVM: riscv: selftests: Enable supported test cases dayss1224
  2025-08-07 14:59 ` [PATCH v2 1/3] KVM: riscv: selftests: Add common " dayss1224
@ 2025-08-07 14:59 ` dayss1224
  2025-08-18 20:49   ` Andrew Jones
  2025-08-07 14:59 ` [PATCH v2 3/3] KVM: riscv: selftests: Add missing headers for new testcases dayss1224
  2025-08-19  0:20 ` [PATCH v2 0/3] KVM: riscv: selftests: Enable supported test cases Andrew Jones
  3 siblings, 1 reply; 8+ messages in thread
From: dayss1224 @ 2025-08-07 14:59 UTC (permalink / raw)
  To: kvm, linux-kselftest, linux-kernel, kvm-riscv, linux-riscv
  Cc: Paolo Bonzini, Shuah Khan, Anup Patel, Atish Patra, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Mathieu Desnoyers,
	Peter Zijlstra, Paul E. McKenney, Boqun Feng, Quan Zhou,
	Dong Yang

From: Quan Zhou <zhouquan@iscas.ac.cn>

To avoid redefinition issues with RISCV_FENCE,
 directly reference the existing macro in `rseq-riscv.h`.

Signed-off-by: Quan Zhou <zhouquan@iscas.ac.cn>
Signed-off-by: Dong Yang <dayss1224@gmail.com>
---
 tools/testing/selftests/rseq/rseq-riscv.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/testing/selftests/rseq/rseq-riscv.h b/tools/testing/selftests/rseq/rseq-riscv.h
index 67d544aaa..06c840e81 100644
--- a/tools/testing/selftests/rseq/rseq-riscv.h
+++ b/tools/testing/selftests/rseq/rseq-riscv.h
@@ -8,6 +8,7 @@
  * exception when executed in all modes.
  */
 #include <endian.h>
+#include <asm/fence.h>
 
 #if defined(__BYTE_ORDER) ? (__BYTE_ORDER == __LITTLE_ENDIAN) : defined(__LITTLE_ENDIAN)
 #define RSEQ_SIG   0xf1401073  /* csrr mhartid, x0 */
@@ -24,8 +25,6 @@
 #define REG_L	__REG_SEL("ld ", "lw ")
 #define REG_S	__REG_SEL("sd ", "sw ")
 
-#define RISCV_FENCE(p, s) \
-	__asm__ __volatile__ ("fence " #p "," #s : : : "memory")
 #define rseq_smp_mb()	RISCV_FENCE(rw, rw)
 #define rseq_smp_rmb()	RISCV_FENCE(r, r)
 #define rseq_smp_wmb()	RISCV_FENCE(w, w)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/3] KVM: riscv: selftests: Add missing headers for new testcases
  2025-08-07 14:59 [PATCH v2 0/3] KVM: riscv: selftests: Enable supported test cases dayss1224
  2025-08-07 14:59 ` [PATCH v2 1/3] KVM: riscv: selftests: Add common " dayss1224
  2025-08-07 14:59 ` [PATCH v2 2/3] KVM: riscv: selftests: Use the existing RISCV_FENCE macro in `rseq-riscv.h` dayss1224
@ 2025-08-07 14:59 ` dayss1224
  2025-08-18 21:01   ` Andrew Jones
  2025-08-19  0:20 ` [PATCH v2 0/3] KVM: riscv: selftests: Enable supported test cases Andrew Jones
  3 siblings, 1 reply; 8+ messages in thread
From: dayss1224 @ 2025-08-07 14:59 UTC (permalink / raw)
  To: kvm, linux-kselftest, linux-kernel, kvm-riscv, linux-riscv
  Cc: Paolo Bonzini, Shuah Khan, Anup Patel, Atish Patra, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Mathieu Desnoyers,
	Peter Zijlstra, Paul E. McKenney, Boqun Feng, Dong Yang,
	Quan Zhou

From: Dong Yang <dayss1224@gmail.com>

Add missing headers to fix the build for new RISC-V KVM selftests.

Signed-off-by: Quan Zhou <zhouquan@iscas.ac.cn>
Signed-off-by: Dong Yang <dayss1224@gmail.com>
---
 tools/testing/selftests/kvm/include/riscv/processor.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/kvm/include/riscv/processor.h b/tools/testing/selftests/kvm/include/riscv/processor.h
index 162f303d9..4cf5ae117 100644
--- a/tools/testing/selftests/kvm/include/riscv/processor.h
+++ b/tools/testing/selftests/kvm/include/riscv/processor.h
@@ -9,7 +9,9 @@
 
 #include <linux/stringify.h>
 #include <asm/csr.h>
+#include <asm/vdso/processor.h>
 #include "kvm_util.h"
+#include "ucall_common.h"
 
 #define INSN_OPCODE_MASK	0x007c
 #define INSN_OPCODE_SHIFT	2
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/3] KVM: riscv: selftests: Use the existing RISCV_FENCE macro in `rseq-riscv.h`
  2025-08-07 14:59 ` [PATCH v2 2/3] KVM: riscv: selftests: Use the existing RISCV_FENCE macro in `rseq-riscv.h` dayss1224
@ 2025-08-18 20:49   ` Andrew Jones
  0 siblings, 0 replies; 8+ messages in thread
From: Andrew Jones @ 2025-08-18 20:49 UTC (permalink / raw)
  To: dayss1224
  Cc: kvm, linux-kselftest, linux-kernel, kvm-riscv, linux-riscv,
	Paolo Bonzini, Shuah Khan, Anup Patel, Atish Patra, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Mathieu Desnoyers,
	Peter Zijlstra, Paul E. McKenney, Boqun Feng, Quan Zhou

On Thu, Aug 07, 2025 at 10:59:29PM +0800, dayss1224@gmail.com wrote:
> From: Quan Zhou <zhouquan@iscas.ac.cn>
> 
> To avoid redefinition issues with RISCV_FENCE,
>  directly reference the existing macro in `rseq-riscv.h`.
> 
> Signed-off-by: Quan Zhou <zhouquan@iscas.ac.cn>
> Signed-off-by: Dong Yang <dayss1224@gmail.com>
> ---
>  tools/testing/selftests/rseq/rseq-riscv.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/rseq/rseq-riscv.h b/tools/testing/selftests/rseq/rseq-riscv.h
> index 67d544aaa..06c840e81 100644
> --- a/tools/testing/selftests/rseq/rseq-riscv.h
> +++ b/tools/testing/selftests/rseq/rseq-riscv.h
> @@ -8,6 +8,7 @@
>   * exception when executed in all modes.
>   */
>  #include <endian.h>
> +#include <asm/fence.h>
>  
>  #if defined(__BYTE_ORDER) ? (__BYTE_ORDER == __LITTLE_ENDIAN) : defined(__LITTLE_ENDIAN)
>  #define RSEQ_SIG   0xf1401073  /* csrr mhartid, x0 */
> @@ -24,8 +25,6 @@
>  #define REG_L	__REG_SEL("ld ", "lw ")
>  #define REG_S	__REG_SEL("sd ", "sw ")
>  
> -#define RISCV_FENCE(p, s) \
> -	__asm__ __volatile__ ("fence " #p "," #s : : : "memory")
>  #define rseq_smp_mb()	RISCV_FENCE(rw, rw)
>  #define rseq_smp_rmb()	RISCV_FENCE(r, r)
>  #define rseq_smp_wmb()	RISCV_FENCE(w, w)
> -- 
> 2.34.1
>

Reviewed-by: Andrew Jones <ajones@ventanamicro.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/3] KVM: riscv: selftests: Add missing headers for new testcases
  2025-08-07 14:59 ` [PATCH v2 3/3] KVM: riscv: selftests: Add missing headers for new testcases dayss1224
@ 2025-08-18 21:01   ` Andrew Jones
  0 siblings, 0 replies; 8+ messages in thread
From: Andrew Jones @ 2025-08-18 21:01 UTC (permalink / raw)
  To: dayss1224
  Cc: kvm, linux-kselftest, linux-kernel, kvm-riscv, linux-riscv,
	Paolo Bonzini, Shuah Khan, Anup Patel, Atish Patra, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Mathieu Desnoyers,
	Peter Zijlstra, Paul E. McKenney, Boqun Feng, Quan Zhou

On Thu, Aug 07, 2025 at 10:59:30PM +0800, dayss1224@gmail.com wrote:
> From: Dong Yang <dayss1224@gmail.com>
> 
> Add missing headers to fix the build for new RISC-V KVM selftests.
> 
> Signed-off-by: Quan Zhou <zhouquan@iscas.ac.cn>
> Signed-off-by: Dong Yang <dayss1224@gmail.com>
> ---
>  tools/testing/selftests/kvm/include/riscv/processor.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/testing/selftests/kvm/include/riscv/processor.h b/tools/testing/selftests/kvm/include/riscv/processor.h
> index 162f303d9..4cf5ae117 100644
> --- a/tools/testing/selftests/kvm/include/riscv/processor.h
> +++ b/tools/testing/selftests/kvm/include/riscv/processor.h
> @@ -9,7 +9,9 @@
>  
>  #include <linux/stringify.h>
>  #include <asm/csr.h>
> +#include <asm/vdso/processor.h>

This is fine, but...

>  #include "kvm_util.h"
> +#include "ucall_common.h"

...this isn't correct. We should instead add this include line to all the
source files that need it:

access_tracking_perf_test.c
memslot_modification_stress_test.c
memslot_perf_test.c


Thanks,
drew

>  
>  #define INSN_OPCODE_MASK	0x007c
>  #define INSN_OPCODE_SHIFT	2
> -- 
> 2.34.1
> 
> 
> -- 
> kvm-riscv mailing list
> kvm-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kvm-riscv

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/3] KVM: riscv: selftests: Add common supported test cases
  2025-08-07 14:59 ` [PATCH v2 1/3] KVM: riscv: selftests: Add common " dayss1224
@ 2025-08-19  0:20   ` Andrew Jones
  0 siblings, 0 replies; 8+ messages in thread
From: Andrew Jones @ 2025-08-19  0:20 UTC (permalink / raw)
  To: dayss1224
  Cc: kvm, linux-kselftest, linux-kernel, kvm-riscv, linux-riscv,
	Paolo Bonzini, Shuah Khan, Anup Patel, Atish Patra, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Mathieu Desnoyers,
	Peter Zijlstra, Paul E. McKenney, Boqun Feng, Quan Zhou

On Thu, Aug 07, 2025 at 10:59:28PM +0800, dayss1224@gmail.com wrote:
> From: Quan Zhou <zhouquan@iscas.ac.cn>
> 
> Some common KVM test cases are supported on riscv now as following:
> 
>     access_tracking_perf_test
>     dirty_log_perf_test
>     memslot_modification_stress_test
>     memslot_perf_test
>     mmu_stress_test
>     rseq_test

I gave these a light testing after pulling together an appropriate config
(we should probably better document needed config symbols...) The tests
seemed to mostly work for me, so ack for including them.

> 
> Signed-off-by: Quan Zhou <zhouquan@iscas.ac.cn>
> Signed-off-by: Dong Yang <dayss1224@gmail.com>
> ---
>  tools/testing/selftests/kvm/Makefile.kvm | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tools/testing/selftests/kvm/Makefile.kvm b/tools/testing/selftests/kvm/Makefile.kvm
> index 38b95998e..3a7186551 100644
> --- a/tools/testing/selftests/kvm/Makefile.kvm
> +++ b/tools/testing/selftests/kvm/Makefile.kvm
> @@ -197,6 +197,12 @@ TEST_GEN_PROGS_riscv += arch_timer
>  TEST_GEN_PROGS_riscv += coalesced_io_test
>  TEST_GEN_PROGS_riscv += get-reg-list
>  TEST_GEN_PROGS_riscv += steal_time
> +TEST_GEN_PROGS_riscv += access_tracking_perf_test
> +TEST_GEN_PROGS_riscv += dirty_log_perf_test
> +TEST_GEN_PROGS_riscv += memslot_modification_stress_test
> +TEST_GEN_PROGS_riscv += memslot_perf_test
> +TEST_GEN_PROGS_riscv += mmu_stress_test
> +TEST_GEN_PROGS_riscv += rseq_test

Please integrate into the current list in alphabetical order.

Thanks,
drew

>  
>  TEST_GEN_PROGS_loongarch += coalesced_io_test
>  TEST_GEN_PROGS_loongarch += demand_paging_test
> -- 
> 2.34.1
> 
> 
> -- 
> kvm-riscv mailing list
> kvm-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kvm-riscv

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/3] KVM: riscv: selftests: Enable supported test cases
  2025-08-07 14:59 [PATCH v2 0/3] KVM: riscv: selftests: Enable supported test cases dayss1224
                   ` (2 preceding siblings ...)
  2025-08-07 14:59 ` [PATCH v2 3/3] KVM: riscv: selftests: Add missing headers for new testcases dayss1224
@ 2025-08-19  0:20 ` Andrew Jones
  3 siblings, 0 replies; 8+ messages in thread
From: Andrew Jones @ 2025-08-19  0:20 UTC (permalink / raw)
  To: dayss1224
  Cc: kvm, linux-kselftest, linux-kernel, kvm-riscv, linux-riscv,
	Paolo Bonzini, Shuah Khan, Anup Patel, Atish Patra, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Mathieu Desnoyers,
	Peter Zijlstra, Paul E. McKenney, Boqun Feng

On Thu, Aug 07, 2025 at 10:59:27PM +0800, dayss1224@gmail.com wrote:
> From: Dong Yang <dayss1224@gmail.com>
> 
> Add supported KVM test cases and fix the compilation dependencies.
> ---
> Changes in v2:
> - Delete some repeat KVM test cases on riscv
> - Add missing headers to fix the build for new RISC-V KVM selftests
> 
> Dong Yang (1):
>   KVM: riscv: selftests: Add missing headers for new testcases
> 
> Quan Zhou (2):
>   KVM: riscv: selftests: Add common supported test cases
>   KVM: riscv: selftests: Use the existing RISCV_FENCE macro in
>     `rseq-riscv.h`
> 
>  tools/testing/selftests/kvm/Makefile.kvm              | 6 ++++++
>  tools/testing/selftests/kvm/include/riscv/processor.h | 2 ++
>  tools/testing/selftests/rseq/rseq-riscv.h             | 3 +--
>  3 files changed, 9 insertions(+), 2 deletions(-)
>

The two fix patches need to come before the Makefile patch in order to
avoid breaking the build.

Thanks,
drew

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-08-19  0:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07 14:59 [PATCH v2 0/3] KVM: riscv: selftests: Enable supported test cases dayss1224
2025-08-07 14:59 ` [PATCH v2 1/3] KVM: riscv: selftests: Add common " dayss1224
2025-08-19  0:20   ` Andrew Jones
2025-08-07 14:59 ` [PATCH v2 2/3] KVM: riscv: selftests: Use the existing RISCV_FENCE macro in `rseq-riscv.h` dayss1224
2025-08-18 20:49   ` Andrew Jones
2025-08-07 14:59 ` [PATCH v2 3/3] KVM: riscv: selftests: Add missing headers for new testcases dayss1224
2025-08-18 21:01   ` Andrew Jones
2025-08-19  0:20 ` [PATCH v2 0/3] KVM: riscv: selftests: Enable supported test cases Andrew Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).