[PATCH] RISC-V: KVM: Skip THP support check during dirty logging

wang.yechao255 at zte.com.cn wang.yechao255 at zte.com.cn
Thu Feb 26 03:12:31 PST 2026


From: Wang Yechao <wang.yechao255 at zte.com.cn>

When dirty logging is enabled, guest stage mappings are forced to
PAGE_SIZE granularity. Changing the mapping page size at this point
is incorrect.

Fixes: ed7ae7a34bea ("RISC-V: KVM: Transparent huge page support")
Signed-off-by: Wang Yechao <wang.yechao255 at zte.com.cn>
---
 arch/riscv/kvm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kvm/mmu.c b/arch/riscv/kvm/mmu.c
index 0b75eb2a1820..c3539f660142 100644
--- a/arch/riscv/kvm/mmu.c
+++ b/arch/riscv/kvm/mmu.c
@@ -535,7 +535,7 @@ int kvm_riscv_mmu_map(struct kvm_vcpu *vcpu, struct kvm_memory_slot *memslot,
                goto out_unlock;

        /* Check if we are backed by a THP and thus use block mapping if possible */
-       if (vma_pagesize == PAGE_SIZE)
+       if (!logging && (vma_pagesize == PAGE_SIZE))
                vma_pagesize = transparent_hugepage_adjust(kvm, memslot, hva, &hfn, &gpa);

        if (writable) {
-- 
2.27.0



More information about the linux-riscv mailing list