]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: riscv: Support enabling dirty log gradually in small chunks
authorDong Yang <dayss1224@gmail.com>
Mon, 3 Nov 2025 06:28:25 +0000 (14:28 +0800)
committerAnup Patel <anup@brainfault.org>
Mon, 24 Nov 2025 04:25:36 +0000 (09:55 +0530)
commitdf60cb2e67029e07e23c4fdf9e027aaf1f63cc1a
tree3ba4f1cc77c15e59d6a7d0117745a0c5ec2a9a41
parenta2483d5d1ee9b399d8137691cb0d8dc99cfe7684
KVM: riscv: Support enabling dirty log gradually in small chunks

There is already support of enabling dirty log gradually in small chunks
for x86 in commit 3c9bd4006bfc ("KVM: x86: enable dirty log gradually in
small chunks") and c862626 ("KVM: arm64: Support enabling dirty log
gradually in small chunks"). This adds support for riscv.

x86 and arm64 writes protect both huge pages and normal pages now, so
riscv protect also protects both huge pages and normal pages.

On a nested virtualization setup (RISC-V KVM running inside a QEMU VM
on an [Intel® Core™ i5-12500H] host), I did some tests with a 2G Linux
VM using different backing page sizes. The time taken for
memory_global_dirty_log_start in the L2 QEMU is listed below:

Page Size      Before    After Optimization
  4K            4490.23ms         31.94ms
  2M             48.97ms          45.46ms
  1G             28.40ms          30.93ms

Signed-off-by: Quan Zhou <zhouquan@iscas.ac.cn>
Signed-off-by: Dong Yang <dayss1224@gmail.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20251103062825.9084-1-dayss1224@gmail.com
Signed-off-by: Anup Patel <anup@brainfault.org>
Documentation/virt/kvm/api.rst
arch/riscv/include/asm/kvm_host.h
arch/riscv/kvm/mmu.c