Skip to contentSkip to conversation

KVM: riscv: selftests: Enable supported test cases

PATCH In review [email protected] 3 participants 7 messages Sep 1, 2025 – Sep 4, 2025

Subsystems (5)
KVM Kselftest RISC-V KVM RISC-V +1 more subsystems
lore
Share & tools
lore
#0 lore raw

v3 cover KVM: riscv: selftests: Enable supported test cases

From: Dong Yang <[email protected]>

Add supported KVM test cases and fix the compilation dependencies.
---
Changes in v3:
- Reorder patches to fix build dependencies
- Sort common supported test cases alphabetically
- Move ucall_common.h include from common header to specific source files

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: Use the existing RISCV_FENCE macro in

    `rseq-riscv.h`

KVM: riscv: selftests: Add common supported test cases

 tools/testing/selftests/kvm/Makefile.kvm                    | 6 ++++++
 tools/testing/selftests/kvm/access_tracking_perf_test.c     | 1 +
 tools/testing/selftests/kvm/include/riscv/processor.h       | 1 +
 .../selftests/kvm/memslot_modification_stress_test.c        | 1 +
 tools/testing/selftests/kvm/memslot_perf_test.c             | 1 +
 tools/testing/selftests/rseq/rseq-riscv.h                   | 3 +--
 6 files changed, 11 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/3 KVM: riscv: selftests: Use the existing RISCV_FENCE macro in `rseq-riscv.h`

From: Quan Zhou <[email protected]>

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

---
 tools/testing/selftests/rseq/rseq-riscv.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/testing/selftests/rseq/rseq-riscv.h +1 -2
index 67d544aaa9a3..06c840e81c8b 100644
@@ -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)
Signature · 1 line
2.34.1
#2 lore raw

PATCH v3 2/3 KVM: riscv: selftests: Add missing headers for new testcases

In reply to [email protected]

From: Dong Yang <[email protected]>

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

---
 tools/testing/selftests/kvm/access_tracking_perf_test.c        | 1 +
 tools/testing/selftests/kvm/include/riscv/processor.h          | 1 +
 tools/testing/selftests/kvm/memslot_modification_stress_test.c | 1 +
 tools/testing/selftests/kvm/memslot_perf_test.c                | 1 +
 4 files changed, 4 insertions(+)
tools/testing/selftests/kvm/access_tracking_perf_test.c +1 -0
index c9de66537ec3..b058f27b2141 100644
@@ -50,6 +50,7 @@
 #include "memstress.h"
 #include "guest_modes.h"
 #include "processor.h"
+#include "ucall_common.h"
 
 #include "cgroup_util.h"
 #include "lru_gen_util.h"
tools/testing/selftests/kvm/include/riscv/processor.h +1 -0
index 162f303d9daa..e58282488beb 100644
@@ -9,6 +9,7 @@
 
 #include <linux/stringify.h>
 #include <asm/csr.h>
+#include <asm/vdso/processor.h>
 #include "kvm_util.h"
 
 #define INSN_OPCODE_MASK	0x007c
tools/testing/selftests/kvm/memslot_modification_stress_test.c +1 -0
index c81a84990eab..3cdfa3b19b85 100644
@@ -22,6 +22,7 @@
 #include "processor.h"
 #include "test_util.h"
 #include "guest_modes.h"
+#include "ucall_common.h"
 
 #define DUMMY_MEMSLOT_INDEX 7
 
tools/testing/selftests/kvm/memslot_perf_test.c +1 -0
index e3711beff7f3..5087d082c4b0 100644
@@ -25,6 +25,7 @@
 #include <test_util.h>
 #include <kvm_util.h>
 #include <processor.h>
+#include <ucall_common.h>
 
 #define MEM_EXTRA_SIZE		SZ_64K
 
Signature · 1 line
2.34.1
#3 lore raw

PATCH v3 3/3 KVM: riscv: selftests: Add common supported test cases

In reply to [email protected]

From: Quan Zhou <[email protected]>

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

---
 tools/testing/selftests/kvm/Makefile.kvm | 6 ++++++
 1 file changed, 6 insertions(+)
tools/testing/selftests/kvm/Makefile.kvm +6 -0
index f6fe7a07a0a2..88613a851cc1 100644
@@ -195,9 +195,15 @@ TEST_GEN_PROGS_s390 += rseq_test
 TEST_GEN_PROGS_riscv = $(TEST_GEN_PROGS_COMMON)
 TEST_GEN_PROGS_riscv += riscv/sbi_pmu_test
 TEST_GEN_PROGS_riscv += riscv/ebreak_test
+TEST_GEN_PROGS_riscv += access_tracking_perf_test
 TEST_GEN_PROGS_riscv += arch_timer
 TEST_GEN_PROGS_riscv += coalesced_io_test
+TEST_GEN_PROGS_riscv += dirty_log_perf_test
 TEST_GEN_PROGS_riscv += get-reg-list
+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_riscv += steal_time
 
 TEST_GEN_PROGS_loongarch += coalesced_io_test
Signature · 1 line
2.34.1
Reviewed-by on the v3 series
#4 lore raw
In reply to [email protected]
Quoted 21 lines · On Mon, Sep 01, 2025 at 03:35:48PM +0800, [email protected] wrote:

From: Dong Yang <[email protected]>

Add supported KVM test cases and fix the compilation dependencies.
---
Changes in v3:
- Reorder patches to fix build dependencies
- Sort common supported test cases alphabetically
- Move ucall_common.h include from common header to specific source files

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: Use the existing RISCV_FENCE macro in

    `rseq-riscv.h`

KVM: riscv: selftests: Add common supported test cases

Quoted 10 lines
 tools/testing/selftests/kvm/Makefile.kvm                    | 6 ++++++
 tools/testing/selftests/kvm/access_tracking_perf_test.c     | 1 +
 tools/testing/selftests/kvm/include/riscv/processor.h       | 1 +
 .../selftests/kvm/memslot_modification_stress_test.c        | 1 +
 tools/testing/selftests/kvm/memslot_perf_test.c             | 1 +
 tools/testing/selftests/rseq/rseq-riscv.h                   | 3 +--
 6 files changed, 11 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1

In the future please CC previous reviewers on the entire series (particularly when they have reviewed the entire previous series).

For the series,

maintainer
#6 lore raw
In reply to [email protected]
Quoted 14 lines · On Mon, Sep 1, 2025 at 1:06 PM <[email protected]> wrote:

From: Dong Yang <[email protected]>

Add supported KVM test cases and fix the compilation dependencies.
---
Changes in v3:
- Reorder patches to fix build dependencies
- Sort common supported test cases alphabetically
- Move ucall_common.h include from common header to specific source files

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

Quoted 7 lines

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

Quan Zhou (2):
KVM: riscv: selftests: Use the existing RISCV_FENCE macro in

    `rseq-riscv.h`

KVM: riscv: selftests: Add common supported test cases

Queued this series for Linux-6.18

Thanks,
Anup

author
#5 lore raw
In reply to Andrew Jones
Quoted 30 lines · Andrew Jones
Quoted 29 lines · On Mon, Sep 01, 2025 at 03:35:48PM +0800, [email protected] wrote:

From: Dong Yang <[email protected]>

Add supported KVM test cases and fix the compilation dependencies.
---
Changes in v3:
- Reorder patches to fix build dependencies
- Sort common supported test cases alphabetically
- Move ucall_common.h include from common header to specific source files

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: Use the existing RISCV_FENCE macro in

    `rseq-riscv.h`

KVM: riscv: selftests: Add common supported test cases

 tools/testing/selftests/kvm/Makefile.kvm                    | 6 ++++++
 tools/testing/selftests/kvm/access_tracking_perf_test.c     | 1 +
 tools/testing/selftests/kvm/include/riscv/processor.h       | 1 +
 .../selftests/kvm/memslot_modification_stress_test.c        | 1 +
 tools/testing/selftests/kvm/memslot_perf_test.c             | 1 +
 tools/testing/selftests/rseq/rseq-riscv.h                   | 3 +--
 6 files changed, 11 insertions(+), 2 deletions(-)
Quoted 5 lines
Quoted 2 lines
Signature · 1 line
2.34.1

In the future please CC previous reviewers on the entire series (particularly when they have reviewed the entire previous series).

Okay, I will pay attention to this in the future. Thanks.

Quoted 4 lines

For the series,