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

From: Anup Patel

Date: Tue Mar 03 2026 - 10:50:49 EST


On Thu, Feb 26, 2026 at 4:42 PM <wang.yechao255@xxxxxxxxxx> wrote:
>
> From: Wang Yechao <wang.yechao255@xxxxxxxxxx>
>
> 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@xxxxxxxxxx>

LGTM.

Reviewed-by: Anup Patel <anup@xxxxxxxxxxxxxx>

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