arch/riscv/kvm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
From: Wang Yechao <wang.yechao255@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@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
On Thu, Feb 26, 2026 at 4:42 PM <wang.yechao255@zte.com.cn> wrote:
>
> From: Wang Yechao <wang.yechao255@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@zte.com.cn>
LGTM.
Reviewed-by: Anup Patel <anup@brainfault.org>
Queued this patch as fix for Linux-7.0-rcX
Thanks,
Anup
> ---
> 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
© 2016 - 2026 Red Hat, Inc.