KVM: riscv: selftests: Enable supported test cases
Subsystems (5)
v2 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 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(-)
Signature · 1 line
2.34.1
PATCH v2 1/3 KVM: riscv: selftests: Add common supported test cases
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
@@ -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
Signature · 1 line
2.34.1
PATCH v2 2/3 KVM: riscv: selftests: Use the existing RISCV_FENCE macro in `rseq-riscv.h`
In reply to [email protected]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
@@ -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
PATCH v2 3/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/include/riscv/processor.h | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/kvm/include/riscv/processor.h +2 -0
@@ -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
Signature · 1 line
2.34.1
Re: [PATCH v2 2/3] KVM: riscv: selftests: Use the existing RISCV_FENCE macro in `rseq-riscv.h`
In reply to [email protected]Quoted 35 lines · On Thu, Aug 07, 2025 at 10:59:29PM +0800, [email protected] wrote:
From: Quan Zhou <[email protected]>
To avoid redefinition issues with
RISCV_FENCE,
directly reference the existing macro inrseq-riscv.h.Signed-off-by Quan Zhou <[email protected]>Signed-off-by Dong Yang <[email protected]>--- tools/testing/selftests/rseq/rseq-riscv.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)tools/testing/selftests/rseq/rseq-riscv.h +1
-2@@ -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
Re: [PATCH v2 3/3] KVM: riscv: selftests: Add missing headers for new testcases
In reply to [email protected]Quoted 15 lines · On Thu, Aug 07, 2025 at 10:59:30PM +0800, [email protected] wrote:
From: Dong Yang <[email protected]>
Add missing headers to fix the build for new RISC-V KVM selftests.
Signed-off-by Quan Zhou <[email protected]>Signed-off-by Dong Yang <[email protected]>--- tools/testing/selftests/kvm/include/riscv/processor.h | 2 ++ 1 file changed, 2 insertions(+)tools/testing/selftests/kvm/include/riscv/processor.h +0
-0
tools/testing/selftests/kvm/include/riscv/processor.h line 12
Quoted 4 lines
tools/testing/selftests/kvm/include/riscv/processor.h +1
-0@@ -9,7 +9,9 @@#include <linux/stringify.h> #include <asm/csr.h> +#include <asm/vdso/processor.h>
This is fine, but...
tools/testing/selftests/kvm/include/riscv/processor.h line 14
Quoted 2 lines
tools/testing/selftests/kvm/include/riscv/processor.h +1
-0#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.cmemslot_modification_stress_test.cmemslot_perf_test.c
Thanks,
drew
Quoted 11 lines
tools/testing/selftests/kvm/include/riscv/processor.h +0
-0#define INSN_OPCODE_MASK 0x007c#define INSN_OPCODE_SHIFT 2Signature · 7 lines
2.34.1 -- kvm-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kvm-riscv
Re: [PATCH v2 1/3] KVM: riscv: selftests: Add common supported test cases
In reply to [email protected]Quoted 10 lines · On Thu, Aug 07, 2025 at 10:59:28PM +0800, [email protected] wrote:
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
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.
Quoted 12 lines
Signed-off-by Quan Zhou <[email protected]>Signed-off-by Dong Yang <[email protected]>--- tools/testing/selftests/kvm/Makefile.kvm | 6 ++++++ 1 file changed, 6 insertions(+)tools/testing/selftests/kvm/Makefile.kvm +0
-0
tools/testing/selftests/kvm/Makefile.kvm TEST_GEN_PROGS_riscv += arch_timer · line 205
Quoted 9 lines
tools/testing/selftests/kvm/Makefile.kvm +6
-0@@ -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
Quoted 11 lines
tools/testing/selftests/kvm/Makefile.kvm +0
-0TEST_GEN_PROGS_loongarch += coalesced_io_test TEST_GEN_PROGS_loongarch += demand_paging_testSignature · 7 lines
2.34.1 -- kvm-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kvm-riscv
Quoted 14 lines · On Thu, Aug 07, 2025 at 10:59:27PM +0800, [email protected] wrote:
From: Dong Yang <[email protected]>
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 selftestsDong Yang (1):
KVM: riscv: selftests: Add missing headers for new testcasesQuan Zhou (2):
KVM: riscv: selftests: Add common supported test cases
KVM: riscv: selftests: Use the existingRISCV_FENCEmacro in
Quoted 7 lines
`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