RISC-V: KVM: Enable ring-based dirty memory tracking
Subsystems (6)
cover RISC-V: KVM: Enable ring-based dirty memory tracking
From: Quan Zhou <[email protected]>
Enable ring-based dirty memory tracking and add some common KVM tests for riscv.
Quan Zhou (2):
RISC-V: KVM: Enable ring-based dirty memory tracking
KVM: riscv: selftests: Add common supported test cases
Documentation/virt/kvm/api.rst | 2 +- arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/Kconfig | 1 + arch/riscv/kvm/vcpu.c | 18 ++++++++++++++++-- tools/testing/selftests/kvm/Makefile.kvm | 12 ++++++++++++ .../selftests/kvm/include/riscv/processor.h | 2 ++ tools/testing/selftests/rseq/rseq-riscv.h | 3 +-- 7 files changed, 34 insertions(+), 5 deletions(-)
Signature · 7 lines
2.34.1 -- kvm-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kvm-riscv
PATCH 1/2 RISC-V: KVM: Enable ring-based dirty memory tracking
From: Quan Zhou <[email protected]>
Enable ring-based dirty memory tracking on riscv:
- Enable CONFIG_HAVE_KVM_DIRTY_RING_ACQ_REL as riscv is weakly ordered.
- Set KVM_DIRTY_LOG_PAGE_OFFSET for the ring buffer's physical page offset.
- Add a check to kvm_vcpu_kvm_riscv_check_vcpu_requests for checking whether the dirty ring is soft full.
To handle vCPU requests that cause exits to userspace, modified the kvm_riscv_check_vcpu_requests to return a value (currently only returns 0 or 1).
--- Documentation/virt/kvm/api.rst | 2 +- arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/Kconfig | 1 + arch/riscv/kvm/vcpu.c | 18 ++++++++++++++++-- 4 files changed, 19 insertions(+), 3 deletions(-)
Documentation/virt/kvm/api.rst +1 -1
@@ -8316,7 +8316,7 @@ core crystal clock frequency, if a non-zero CPUID 0x15 is exposed to the guest. 7.36 KVM_CAP_DIRTY_LOG_RING/KVM_CAP_DIRTY_LOG_RING_ACQ_REL ---------------------------------------------------------- -:Architectures: x86, arm64 +:Architectures: x86, arm64, riscv :Type: vm :Parameters: args[0] - size of the dirty log ring
arch/riscv/include/uapi/asm/kvm.h +1 -0
@@ -18,6 +18,7 @@#define __KVM_HAVE_IRQ_LINE#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 +#define KVM_DIRTY_LOG_PAGE_OFFSET 64#define KVM_INTERRUPT_SET -1U#define KVM_INTERRUPT_UNSET -2U
arch/riscv/kvm/Kconfig +1 -0
@@ -25,6 +25,7 @@ config KVM select HAVE_KVM_MSI select HAVE_KVM_VCPU_ASYNC_IOCTL select HAVE_KVM_READONLY_MEM + select HAVE_KVM_DIRTY_RING_ACQ_REL select KVM_COMMON select KVM_GENERIC_DIRTYLOG_READ_PROTECT select KVM_GENERIC_HARDWARE_ENABLING
arch/riscv/kvm/vcpu.c +16 -2
@@ -690,7 +690,14 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) } } -static void kvm_riscv_check_vcpu_requests (struct kvm_vcpu *vcpu) +/** +* check_vcpu_requests - check and handle pending vCPU requests +* @vcpu: the VCPU pointer +* +* Return: 1 if we should enter the guest +* 0 if we should exit to userspace +*/ +static int kvm_riscv_check_vcpu_requests (struct kvm_vcpu *vcpu) {struct rcuwait *wait =kvm_arch_vcpu_get_wait (vcpu);
@@ -735,7 +742,12 @@ static void kvm_riscv_check_vcpu_requests(struct kvm_vcpu *vcpu)if (kvm_check_request (KVM_REQ_STEAL_UPDATE , vcpu))kvm_riscv_vcpu_record_steal_time (vcpu); + +if (kvm_dirty_ring_check_request (vcpu)) +return 0 ; } + +return 1 ; }static void kvm_riscv_update_hvip (struct kvm_vcpu *vcpu)
@@ -917,7 +929,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)kvm_riscv_gstage_vmid_update (vcpu); -kvm_riscv_check_vcpu_requests (vcpu); + ret =kvm_riscv_check_vcpu_requests (vcpu); +if (ret <=0 ) +continue ;preempt_disable ();
Signature · 1 line
2.34.1
Quoted 12 lines · On Fri, Jun 13, 2025 at 5:08 PM <[email protected]> wrote:
From: Quan Zhou <[email protected]>
Enable ring-based dirty memory tracking on riscv:
- Enable
CONFIG_HAVE_KVM_DIRTY_RING_ACQ_RELas riscv is weakly ordered.
- SetKVM_DIRTY_LOG_PAGE_OFFSETfor the ring buffer's physical page offset.
- Add a check tokvm_vcpu_kvm_riscv_check_vcpu_requestsfor checking whether the dirty ring is soft full.
Quoted 5 lines
To handle vCPU requests that cause exits to userspace, modified the
kvm_riscv_check_vcpu_requeststo return a value (currently only returns 0 or 1).Signed-off-by Quan Zhou <[email protected]>
LGTM.
Queued this patch for Linux-6.17
Thanks,
Anup
Quoted 91 lines
--- Documentation/virt/kvm/api.rst | 2 +- arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/Kconfig | 1 + arch/riscv/kvm/vcpu.c | 18 ++++++++++++++++-- 4 files changed, 19 insertions(+), 3 deletions(-)Documentation/virt/kvm/api.rst +1
-1@@ -8316,7 +8316,7 @@ core crystal clock frequency, if a non-zero CPUID 0x15 is exposed to the guest. 7.36 KVM_CAP_DIRTY_LOG_RING/KVM_CAP_DIRTY_LOG_RING_ACQ_REL ---------------------------------------------------------- -:Architectures: x86, arm64 +:Architectures: x86, arm64, riscv :Type: vm :Parameters: args[0] - size of the dirty log ringarch/riscv/include/uapi/asm/kvm.h +1
-0@@ -18,6 +18,7 @@#define __KVM_HAVE_IRQ_LINE#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 +#define KVM_DIRTY_LOG_PAGE_OFFSET 64#define KVM_INTERRUPT_SET -1U#define KVM_INTERRUPT_UNSET -2Uarch/riscv/kvm/Kconfig +1
-0@@ -25,6 +25,7 @@ config KVM select HAVE_KVM_MSI select HAVE_KVM_VCPU_ASYNC_IOCTL select HAVE_KVM_READONLY_MEM + select HAVE_KVM_DIRTY_RING_ACQ_REL select KVM_COMMON select KVM_GENERIC_DIRTYLOG_READ_PROTECT select KVM_GENERIC_HARDWARE_ENABLINGarch/riscv/kvm/vcpu.c +16
-3@@ -690,7 +690,14 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) } } -static void kvm_riscv_check_vcpu_requests (struct kvm_vcpu *vcpu) +/** +* check_vcpu_requests - check and handle pending vCPU requests +* @vcpu: the VCPU pointer +* +* Return: 1 if we should enter the guest +* 0 if we should exit to userspace +*/ +static int kvm_riscv_check_vcpu_requests (struct kvm_vcpu *vcpu) {struct rcuwait *wait =kvm_arch_vcpu_get_wait (vcpu);@@ -735,7 +742,12 @@ static void kvm_riscv_check_vcpu_requests(struct kvm_vcpu *vcpu)if (kvm_check_request (KVM_REQ_STEAL_UPDATE , vcpu))kvm_riscv_vcpu_record_steal_time (vcpu); + +if (kvm_dirty_ring_check_request (vcpu)) +return 0 ; } + +return 1 ; }static void kvm_riscv_update_hvip (struct kvm_vcpu *vcpu)@@ -917,7 +929,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)kvm_riscv_gstage_vmid_update (vcpu); -kvm_riscv_check_vcpu_requests (vcpu); + ret =kvm_riscv_check_vcpu_requests (vcpu); +if (ret <=0 ) +continue ;preempt_disable (); --2.34.1
PATCH 2/2 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
demand_paging_test
dirty_log_perf_test
dirty_log_test
guest_print_test
kvm_binary_stats_test
kvm_create_max_vcpus
kvm_page_table_test
memslot_modification_stress_test
memslot_perf_test
rseq_test
set_memory_region_test
Add missing headers for tests and fix RISCV_FENCE redefinition in rseq-riscv.h by using the existing macro from <asm/fence.h>.
--- tools/testing/selftests/kvm/Makefile.kvm | 12 ++++++++++++ .../testing/selftests/kvm/include/riscv/processor.h | 2 ++ tools/testing/selftests/rseq/rseq-riscv.h | 3 +-- 3 files changed, 15 insertions(+), 2 deletions(-)
tools/testing/selftests/kvm/Makefile.kvm +12 -0
@@ -197,6 +197,18 @@ 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 += demand_paging_test +TEST_GEN_PROGS_riscv += dirty_log_perf_test +TEST_GEN_PROGS_riscv += dirty_log_test +TEST_GEN_PROGS_riscv += guest_print_test +TEST_GEN_PROGS_riscv += kvm_binary_stats_test +TEST_GEN_PROGS_riscv += kvm_create_max_vcpus +TEST_GEN_PROGS_riscv += kvm_page_table_test +TEST_GEN_PROGS_riscv += memslot_modification_stress_test +TEST_GEN_PROGS_riscv += memslot_perf_test +TEST_GEN_PROGS_riscv += rseq_test +TEST_GEN_PROGS_riscv += set_memory_region_test TEST_GEN_PROGS_loongarch += coalesced_io_test TEST_GEN_PROGS_loongarch += demand_paging_test
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
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 2/2] KVM: riscv: selftests: Add common supported test cases
Quoted 4 lines · On Fri, Jun 13, 2025 at 07:30:13PM +0800, [email protected] wrote:
From: Quan Zhou <[email protected]>
Some common KVM test cases are supported on riscv now as following:
Quoted 12 lines
access_tracking_perf_test
demand_paging_test
dirty_log_perf_test
dirty_log_test
guest_print_test
kvm_binary_stats_test
kvm_create_max_vcpus
kvm_page_table_test
memslot_modification_stress_test
memslot_perf_test
rseq_test
set_memory_region_test
Half this list is already build for riscv since they're common. See TEST_GEN_PROGS_COMMON. If the other half can be built and run then please send a separate patch, not something tacked onto this series, since they're all unrelated to the series.
Quoted 39 lines
Add missing headers for tests and fix
RISCV_FENCEredefinition inrseq-riscv.hby using the existing macro from <asm/fence.h>.Signed-off-by Quan Zhou <[email protected]>--- tools/testing/selftests/kvm/Makefile.kvm | 12 ++++++++++++ .../testing/selftests/kvm/include/riscv/processor.h | 2 ++ tools/testing/selftests/rseq/rseq-riscv.h | 3 +-- 3 files changed, 15 insertions(+), 2 deletions(-)tools/testing/selftests/kvm/Makefile.kvm +12
-0@@ -197,6 +197,18 @@ 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 += demand_paging_test +TEST_GEN_PROGS_riscv += dirty_log_perf_test +TEST_GEN_PROGS_riscv += dirty_log_test +TEST_GEN_PROGS_riscv += guest_print_test +TEST_GEN_PROGS_riscv += kvm_binary_stats_test +TEST_GEN_PROGS_riscv += kvm_create_max_vcpus +TEST_GEN_PROGS_riscv += kvm_page_table_test +TEST_GEN_PROGS_riscv += memslot_modification_stress_test +TEST_GEN_PROGS_riscv += memslot_perf_test +TEST_GEN_PROGS_riscv += rseq_test +TEST_GEN_PROGS_riscv += set_memory_region_test TEST_GEN_PROGS_loongarch += coalesced_io_test TEST_GEN_PROGS_loongarch += demand_paging_testtools/testing/selftests/kvm/include/riscv/processor.h +0
-0
tools/testing/selftests/kvm/include/riscv/processor.h line 14
Quoted 6 lines
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"
These should be included directly from the tests that need them.
Quoted 26 lines
tools/testing/selftests/kvm/include/riscv/processor.h +0
-0#define INSN_OPCODE_MASK 0x007c#define INSN_OPCODE_SHIFT 2tools/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
tools/testing/selftests/rseq isn't under KVM's purview, so this should be a separate patch CC'ing the appropriate people and lists.
Thanks,
drew
Re: [PATCH 2/2] KVM: riscv: selftests: Add common supported test cases
Quoted 101 lines · Andrew Jones
Quoted 4 lines · On Fri, Jun 13, 2025 at 07:30:13PM +0800, [email protected] wrote:
From: Quan Zhou <[email protected]>
Some common KVM test cases are supported on riscv now as following:
Quoted 12 lines
access_tracking_perf_test
demand_paging_test
dirty_log_perf_test
dirty_log_test
guest_print_test
kvm_binary_stats_test
kvm_create_max_vcpus
kvm_page_table_test
memslot_modification_stress_test
memslot_perf_test
rseq_test
set_memory_region_testHalf this list is already build for riscv since they're common. See
TEST_GEN_PROGS_COMMON. If the other half can be built and run then please send a separate patch, not something tacked onto this series, since they're all unrelated to the series.Quoted 39 lines
Add missing headers for tests and fix
RISCV_FENCEredefinition inrseq-riscv.hby using the existing macro from <asm/fence.h>.Signed-off-by Quan Zhou <[email protected]>--- tools/testing/selftests/kvm/Makefile.kvm | 12 ++++++++++++ .../testing/selftests/kvm/include/riscv/processor.h | 2 ++ tools/testing/selftests/rseq/rseq-riscv.h | 3 +-- 3 files changed, 15 insertions(+), 2 deletions(-)tools/testing/selftests/kvm/Makefile.kvm +12
-0@@ -197,6 +197,18 @@ 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 += demand_paging_test +TEST_GEN_PROGS_riscv += dirty_log_perf_test +TEST_GEN_PROGS_riscv += dirty_log_test +TEST_GEN_PROGS_riscv += guest_print_test +TEST_GEN_PROGS_riscv += kvm_binary_stats_test +TEST_GEN_PROGS_riscv += kvm_create_max_vcpus +TEST_GEN_PROGS_riscv += kvm_page_table_test +TEST_GEN_PROGS_riscv += memslot_modification_stress_test +TEST_GEN_PROGS_riscv += memslot_perf_test +TEST_GEN_PROGS_riscv += rseq_test +TEST_GEN_PROGS_riscv += set_memory_region_test TEST_GEN_PROGS_loongarch += coalesced_io_test TEST_GEN_PROGS_loongarch += demand_paging_testtools/testing/selftests/kvm/include/riscv/processor.h +0
-0tools/testing/selftests/kvm/include/riscv/processor.h line 14
Quoted 6 lines
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" These should be included directly from the tests that need them.
Quoted 26 lines
tools/testing/selftests/kvm/include/riscv/processor.h +0
-0#define INSN_OPCODE_MASK 0x007c#define INSN_OPCODE_SHIFT 2tools/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
tools/testing/selftests/rseqisn't under KVM's purview, so this should be a separate patch CC'ing the appropriate people and lists.
Quoted 2 lines
Thanks,
drew
Thanks so much for your review, I'll split and modify this set of patches.
Regards,
Quan
Anup Patel
maintainerRe: [PATCH 2/2] KVM: riscv: selftests: Add common supported test cases
In reply to [email protected]Quoted 18 lines · On Fri, Jun 13, 2025 at 5:08 PM <[email protected]> wrote:
From: Quan Zhou <[email protected]>
Some common KVM test cases are supported on riscv now as following:
access_tracking_perf_test
demand_paging_test
dirty_log_perf_test
dirty_log_test
guest_print_test
kvm_binary_stats_test
kvm_create_max_vcpus
kvm_page_table_test
memslot_modification_stress_test
memslot_perf_test
rseq_test
set_memory_region_test
Quoted 4 lines
Add missing headers for tests and fix
RISCV_FENCEredefinition inrseq-riscv.hby using the existing macro from <asm/fence.h>.Signed-off-by Quan Zhou <[email protected]>
Please address Drew's comments and send v2 of only this patch. The first patch of this series is already queued.
Regards,
Anup
Quoted 67 lines
--- tools/testing/selftests/kvm/Makefile.kvm | 12 ++++++++++++ .../testing/selftests/kvm/include/riscv/processor.h | 2 ++ tools/testing/selftests/rseq/rseq-riscv.h | 3 +-- 3 files changed, 15 insertions(+), 2 deletions(-)tools/testing/selftests/kvm/Makefile.kvm +12
-0@@ -197,6 +197,18 @@ 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 += demand_paging_test +TEST_GEN_PROGS_riscv += dirty_log_perf_test +TEST_GEN_PROGS_riscv += dirty_log_test +TEST_GEN_PROGS_riscv += guest_print_test +TEST_GEN_PROGS_riscv += kvm_binary_stats_test +TEST_GEN_PROGS_riscv += kvm_create_max_vcpus +TEST_GEN_PROGS_riscv += kvm_page_table_test +TEST_GEN_PROGS_riscv += memslot_modification_stress_test +TEST_GEN_PROGS_riscv += memslot_perf_test +TEST_GEN_PROGS_riscv += rseq_test +TEST_GEN_PROGS_riscv += set_memory_region_test TEST_GEN_PROGS_loongarch += coalesced_io_test TEST_GEN_PROGS_loongarch += demand_paging_testtools/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 2tools/testing/selftests/rseq/rseq-riscv.h +1
-3@@ -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
Re: [PATCH 2/2] KVM: riscv: selftests: Add common supported test cases
Quoted 22 lines · Anup Patel
Quoted 21 lines · On Fri, Jun 13, 2025 at 5:08 PM <[email protected]> wrote:
From: Quan Zhou <[email protected]>
Some common KVM test cases are supported on riscv now as following:
access_tracking_perf_test
demand_paging_test
dirty_log_perf_test
dirty_log_test
guest_print_test
kvm_binary_stats_test
kvm_create_max_vcpus
kvm_page_table_test
memslot_modification_stress_test
memslot_perf_test
rseq_test
set_memory_region_testAdd missing headers for tests and fix
RISCV_FENCEredefinition inrseq-riscv.hby using the existing macro from <asm/fence.h>.
Quoted 7 lines
Quoted 1 line
Signed-off-by Quan Zhou <[email protected]>Please address Drew's comments and send v2 of only this patch. The first patch of this series is already queued.
Regards,
Anup
Okay, I'll split and modify this set of patches. Thanks.
Regards,
Quan
Quoted 68 lines
Quoted 68 lines
--- tools/testing/selftests/kvm/Makefile.kvm | 12 ++++++++++++ .../testing/selftests/kvm/include/riscv/processor.h | 2 ++ tools/testing/selftests/rseq/rseq-riscv.h | 3 +-- 3 files changed, 15 insertions(+), 2 deletions(-)tools/testing/selftests/kvm/Makefile.kvm +12
-0@@ -197,6 +197,18 @@ 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 += demand_paging_test +TEST_GEN_PROGS_riscv += dirty_log_perf_test +TEST_GEN_PROGS_riscv += dirty_log_test +TEST_GEN_PROGS_riscv += guest_print_test +TEST_GEN_PROGS_riscv += kvm_binary_stats_test +TEST_GEN_PROGS_riscv += kvm_create_max_vcpus +TEST_GEN_PROGS_riscv += kvm_page_table_test +TEST_GEN_PROGS_riscv += memslot_modification_stress_test +TEST_GEN_PROGS_riscv += memslot_perf_test +TEST_GEN_PROGS_riscv += rseq_test +TEST_GEN_PROGS_riscv += set_memory_region_test TEST_GEN_PROGS_loongarch += coalesced_io_test TEST_GEN_PROGS_loongarch += demand_paging_testtools/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 2tools/testing/selftests/rseq/rseq-riscv.h +1
-3@@ -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