[PATCH 0/3] RISC-V: KVM: Huge page recovery during disable-dirty-log

From: wang.yechao255

Date: Tue Apr 07 2026 - 05:11:26 EST


From: Wang Yechao <wang.yechao255@xxxxxxxxxx>

When dirty logging is enabled, the gstage mappings are split into
4K pages to track dirty pages[1]. If the migration fails or is canceled,
in order to keep the VM's performance consistent with that before
dirty logging was enabled, It's need to recover the gstage huge page mappings
when dirty logging is disabled.

With this series, dirty_log_perf_test shows a decrease in the number of
vCPU faults:

$ perf stat -e kvm:kvm_page_fault \
/dirty_log_perf_test -s anonymous_hugetlb_1gb -v 1 -e -b 1G

Before: 524,819 kvm:kvm_page_fault
After : 263,211 kvm:kvm_page_fault

[1].https://lore.kernel.org/linux-riscv/CAK9=C2Vb73snLT0uEY=5S5dQc6VXc_u4S60+9+sCLpyXZnHTWA@xxxxxxxxxxxxxx/T/#t

Wang Yechao (3):
RISC-V: KVM: Refactor kvm_arch_commit_memory_region()
RISC-V: KVM: add tracepoints for guest page faults
RISC-V: KVM: Recover gstage huge page mappings during disable-dirty-log

arch/riscv/include/asm/kvm_gstage.h | 4 ++
arch/riscv/kvm/gstage.c | 42 +++++++++++++++++++
arch/riscv/kvm/mmu.c | 63 ++++++++++++++++++++++++++++-
arch/riscv/kvm/trace.h | 25 ++++++++++++
arch/riscv/kvm/vcpu_exit.c | 3 ++
5 files changed, 136 insertions(+), 1 deletion(-)

--
2.47.3