Re: [PATCH v4 1/5] RISC-V: KVM: Add the split page cache for ioctl context
Anup Patel <[email protected]> Fri, 31 Jul 2026 11:04:42 +0530
| Newsgroups | org.infradead.lists.linux-riscv,org.infradead.lists.kvm-riscv,org.kernel.vger.kvm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAAhSdy0_dCHC+ZVG7HZdtUxZWWX_KG3YfN=ngVdpy-7_pquUFA@mail.gmail.com> |
On Wed, Jul 1, 2026 at 5:41 PM Wang Yechao <[email protected]> wrote: > > Add the split page cache for dirty logging enablement and the > KVM_CLEAR_DIRTY_LOG ioctl. > > Signed-off-by: Wang Yechao <[email protected]> > --- > arch/riscv/include/asm/kvm_host.h | 1 + > arch/riscv/kvm/mmu.c | 1 + > arch/riscv/kvm/vm.c | 6 ++++++ > 3 files changed, 8 insertions(+) > > diff --git a/arch/riscv/include/asm/kvm_host.h b/arch/riscv/include/asm/kvm_host.h > index 60017ceec9d2a..69f73fd106a94 100644 > --- a/arch/riscv/include/asm/kvm_host.h > +++ b/arch/riscv/include/asm/kvm_host.h > @@ -86,6 +86,7 @@ struct kvm_arch { > pgd_t *pgd; > phys_addr_t pgd_phys; > unsigned long pgd_levels; > + struct kvm_mmu_memory_cache pgd_split_page_cache; > > /* Guest Timer */ > struct kvm_guest_timer timer; > diff --git a/arch/riscv/kvm/mmu.c b/arch/riscv/kvm/mmu.c > index 082f9b2617338..9cf69bc28b9c5 100644 > --- a/arch/riscv/kvm/mmu.c > +++ b/arch/riscv/kvm/mmu.c > @@ -676,6 +676,7 @@ int kvm_riscv_mmu_alloc_pgd(struct kvm *kvm) > kvm->arch.pgd = page_to_virt(pgd_page); > kvm->arch.pgd_phys = page_to_phys(pgd_page); > kvm->arch.pgd_levels = kvm_riscv_gstage_max_pgd_levels; > + kvm->arch.pgd_split_page_cache.gfp_zero = __GFP_ZERO; > > return 0; > } > diff --git a/arch/riscv/kvm/vm.c b/arch/riscv/kvm/vm.c > index a9f083feeb767..be38f24a297d6 100644 > --- a/arch/riscv/kvm/vm.c > +++ b/arch/riscv/kvm/vm.c > @@ -54,6 +54,12 @@ void kvm_arch_destroy_vm(struct kvm *kvm) > kvm_destroy_vcpus(kvm); > > kvm_riscv_aia_destroy_vm(kvm); > + > + /* > + * Free the split page cache after all vCPUs and devices are destroyed. > + * At this point, there are no concurrent accesses to the cache. > + */ > + kvm_mmu_free_memory_cache(&kvm->arch.pgd_split_page_cache); Better to do this in kvm_riscv_mmu_free_pgd() Regards, Anup _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv