]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
RISC-V: KVM: Split huge pages during fault handling for dirty logging
authorWang Yechao <wang.yechao255@zte.com.cn>
Mon, 30 Mar 2026 08:12:58 +0000 (16:12 +0800)
committerAnup Patel <anup@brainfault.org>
Mon, 30 Mar 2026 08:31:02 +0000 (14:01 +0530)
commit6ad36f39a7691bb59d2486efd467710fcbebee62
tree278b981f0c958058c426c7ef0ed0578f603c5556
parenta216e24fc947573bfbd56471bd7c1f1d8c7a2b19
RISC-V: KVM: Split huge pages during fault handling for dirty logging

During dirty logging, all huge pages are write-protected. When the guest
writes to a write-protected huge page, a page fault is triggered. Before
recovering the write permission, the huge page must be split into smaller
pages (e.g., 4K). After splitting, the normal mapping process proceeds,
allowing write permission to be restored at the smaller page granularity.

If dirty logging is disabled because migration failed or was cancelled,
only recover the write permission at the 4K level, and skip recovering the
huge page mapping at this time to avoid the overhead of freeing page tables.
The huge page mapping can be recovered in the ioctl context, similar to x86,
in a later patch.

Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/202603301612587174XZ6QMCrymBqv30S6BN50@zte.com.cn
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/include/asm/kvm_gstage.h
arch/riscv/kvm/gstage.c