* Re: [PATCH V2] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables [not found] ` <1552397145-10665-1-git-send-email-anshuman.khandual@arm.com> @ 2019-04-01 16:16 ` Will Deacon 2019-04-01 18:34 ` Yu Zhao 2019-04-08 9:09 ` Marc Zyngier 0 siblings, 2 replies; 9+ messages in thread From: Will Deacon @ 2019-04-01 16:16 UTC (permalink / raw) To: Anshuman Khandual Cc: mark.rutland, yuzhao, suzuki.poulose, marc.zyngier, catalin.marinas, julien.thierry, christoffer.dall, linux-mm, james.morse, kvmarm, linux-arm-kernel [+KVM/ARM folks, since I can't take this without an Ack in place from them] My understanding is that this patch is intended to replace patch 3/4 in this series: http://lists.infradead.org/pipermail/linux-arm-kernel/2019-March/638083.html On Tue, Mar 12, 2019 at 06:55:45PM +0530, Anshuman Khandual wrote: > ARM64 standard pgtable functions are going to use pgtable_page_[ctor|dtor] > or pgtable_pmd_page_[ctor|dtor] constructs. At present KVM guest stage-2 > PUD|PMD|PTE level page tabe pages are allocated with __get_free_page() > via mmu_memory_cache_alloc() but released with standard pud|pmd_free() or > pte_free_kernel(). These will fail once they start calling into pgtable_ > [pmd]_page_dtor() for pages which never originally went through respective > constructor functions. Hence convert all stage-2 page table page release > functions to call buddy directly while freeing pages. > > Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com> > Acked-by: Yu Zhao <yuzhao@google.com> > Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> > --- > Changes in V2: > > - Updated stage2_pud_free() with NOP as per Suzuki > - s/__free_page/free_page/ in clear_stage2_pmd_entry() for uniformity > > arch/arm/include/asm/stage2_pgtable.h | 4 ++-- > arch/arm64/include/asm/stage2_pgtable.h | 4 ++-- > virt/kvm/arm/mmu.c | 2 +- > 3 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/arch/arm/include/asm/stage2_pgtable.h b/arch/arm/include/asm/stage2_pgtable.h > index de2089501b8b..fed02c3b4600 100644 > --- a/arch/arm/include/asm/stage2_pgtable.h > +++ b/arch/arm/include/asm/stage2_pgtable.h > @@ -32,14 +32,14 @@ > #define stage2_pgd_present(kvm, pgd) pgd_present(pgd) > #define stage2_pgd_populate(kvm, pgd, pud) pgd_populate(NULL, pgd, pud) > #define stage2_pud_offset(kvm, pgd, address) pud_offset(pgd, address) > -#define stage2_pud_free(kvm, pud) pud_free(NULL, pud) > +#define stage2_pud_free(kvm, pud) do { } while (0) > > #define stage2_pud_none(kvm, pud) pud_none(pud) > #define stage2_pud_clear(kvm, pud) pud_clear(pud) > #define stage2_pud_present(kvm, pud) pud_present(pud) > #define stage2_pud_populate(kvm, pud, pmd) pud_populate(NULL, pud, pmd) > #define stage2_pmd_offset(kvm, pud, address) pmd_offset(pud, address) > -#define stage2_pmd_free(kvm, pmd) pmd_free(NULL, pmd) > +#define stage2_pmd_free(kvm, pmd) free_page((unsigned long)pmd) > > #define stage2_pud_huge(kvm, pud) pud_huge(pud) > > diff --git a/arch/arm64/include/asm/stage2_pgtable.h b/arch/arm64/include/asm/stage2_pgtable.h > index 5412fa40825e..915809e4ac32 100644 > --- a/arch/arm64/include/asm/stage2_pgtable.h > +++ b/arch/arm64/include/asm/stage2_pgtable.h > @@ -119,7 +119,7 @@ static inline pud_t *stage2_pud_offset(struct kvm *kvm, > static inline void stage2_pud_free(struct kvm *kvm, pud_t *pud) > { > if (kvm_stage2_has_pud(kvm)) > - pud_free(NULL, pud); > + free_page((unsigned long)pud); > } > > static inline bool stage2_pud_table_empty(struct kvm *kvm, pud_t *pudp) > @@ -192,7 +192,7 @@ static inline pmd_t *stage2_pmd_offset(struct kvm *kvm, > static inline void stage2_pmd_free(struct kvm *kvm, pmd_t *pmd) > { > if (kvm_stage2_has_pmd(kvm)) > - pmd_free(NULL, pmd); > + free_page((unsigned long)pmd); > } > > static inline bool stage2_pud_huge(struct kvm *kvm, pud_t pud) > diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c > index e9d28a7ca673..cbfbdadca8a5 100644 > --- a/virt/kvm/arm/mmu.c > +++ b/virt/kvm/arm/mmu.c > @@ -191,7 +191,7 @@ static void clear_stage2_pmd_entry(struct kvm *kvm, pmd_t *pmd, phys_addr_t addr > VM_BUG_ON(pmd_thp_or_huge(*pmd)); > pmd_clear(pmd); > kvm_tlb_flush_vmid_ipa(kvm, addr); > - pte_free_kernel(NULL, pte_table); > + free_page((unsigned long)pte_table); > put_page(virt_to_page(pmd)); > } > > -- > 2.20.1 > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V2] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables 2019-04-01 16:16 ` [PATCH V2] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables Will Deacon @ 2019-04-01 18:34 ` Yu Zhao 2019-04-02 9:03 ` Will Deacon 2019-04-08 9:09 ` Marc Zyngier 1 sibling, 1 reply; 9+ messages in thread From: Yu Zhao @ 2019-04-01 18:34 UTC (permalink / raw) To: Will Deacon Cc: mark.rutland, julien.thierry, suzuki.poulose, marc.zyngier, catalin.marinas, Anshuman Khandual, christoffer.dall, linux-mm, james.morse, kvmarm, linux-arm-kernel On Mon, Apr 01, 2019 at 05:16:38PM +0100, Will Deacon wrote: > [+KVM/ARM folks, since I can't take this without an Ack in place from them] > > My understanding is that this patch is intended to replace patch 3/4 in > this series: > > http://lists.infradead.org/pipermail/linux-arm-kernel/2019-March/638083.html Yes, and sorry for the confusion. I could send an updated series once this patch is merged. Thanks. > On Tue, Mar 12, 2019 at 06:55:45PM +0530, Anshuman Khandual wrote: > > ARM64 standard pgtable functions are going to use pgtable_page_[ctor|dtor] > > or pgtable_pmd_page_[ctor|dtor] constructs. At present KVM guest stage-2 > > PUD|PMD|PTE level page tabe pages are allocated with __get_free_page() > > via mmu_memory_cache_alloc() but released with standard pud|pmd_free() or > > pte_free_kernel(). These will fail once they start calling into pgtable_ > > [pmd]_page_dtor() for pages which never originally went through respective > > constructor functions. Hence convert all stage-2 page table page release > > functions to call buddy directly while freeing pages. > > > > Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com> > > Acked-by: Yu Zhao <yuzhao@google.com> > > Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> > > --- > > Changes in V2: > > > > - Updated stage2_pud_free() with NOP as per Suzuki > > - s/__free_page/free_page/ in clear_stage2_pmd_entry() for uniformity > > > > arch/arm/include/asm/stage2_pgtable.h | 4 ++-- > > arch/arm64/include/asm/stage2_pgtable.h | 4 ++-- > > virt/kvm/arm/mmu.c | 2 +- > > 3 files changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/arch/arm/include/asm/stage2_pgtable.h b/arch/arm/include/asm/stage2_pgtable.h > > index de2089501b8b..fed02c3b4600 100644 > > --- a/arch/arm/include/asm/stage2_pgtable.h > > +++ b/arch/arm/include/asm/stage2_pgtable.h > > @@ -32,14 +32,14 @@ > > #define stage2_pgd_present(kvm, pgd) pgd_present(pgd) > > #define stage2_pgd_populate(kvm, pgd, pud) pgd_populate(NULL, pgd, pud) > > #define stage2_pud_offset(kvm, pgd, address) pud_offset(pgd, address) > > -#define stage2_pud_free(kvm, pud) pud_free(NULL, pud) > > +#define stage2_pud_free(kvm, pud) do { } while (0) > > > > #define stage2_pud_none(kvm, pud) pud_none(pud) > > #define stage2_pud_clear(kvm, pud) pud_clear(pud) > > #define stage2_pud_present(kvm, pud) pud_present(pud) > > #define stage2_pud_populate(kvm, pud, pmd) pud_populate(NULL, pud, pmd) > > #define stage2_pmd_offset(kvm, pud, address) pmd_offset(pud, address) > > -#define stage2_pmd_free(kvm, pmd) pmd_free(NULL, pmd) > > +#define stage2_pmd_free(kvm, pmd) free_page((unsigned long)pmd) > > > > #define stage2_pud_huge(kvm, pud) pud_huge(pud) > > > > diff --git a/arch/arm64/include/asm/stage2_pgtable.h b/arch/arm64/include/asm/stage2_pgtable.h > > index 5412fa40825e..915809e4ac32 100644 > > --- a/arch/arm64/include/asm/stage2_pgtable.h > > +++ b/arch/arm64/include/asm/stage2_pgtable.h > > @@ -119,7 +119,7 @@ static inline pud_t *stage2_pud_offset(struct kvm *kvm, > > static inline void stage2_pud_free(struct kvm *kvm, pud_t *pud) > > { > > if (kvm_stage2_has_pud(kvm)) > > - pud_free(NULL, pud); > > + free_page((unsigned long)pud); > > } > > > > static inline bool stage2_pud_table_empty(struct kvm *kvm, pud_t *pudp) > > @@ -192,7 +192,7 @@ static inline pmd_t *stage2_pmd_offset(struct kvm *kvm, > > static inline void stage2_pmd_free(struct kvm *kvm, pmd_t *pmd) > > { > > if (kvm_stage2_has_pmd(kvm)) > > - pmd_free(NULL, pmd); > > + free_page((unsigned long)pmd); > > } > > > > static inline bool stage2_pud_huge(struct kvm *kvm, pud_t pud) > > diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c > > index e9d28a7ca673..cbfbdadca8a5 100644 > > --- a/virt/kvm/arm/mmu.c > > +++ b/virt/kvm/arm/mmu.c > > @@ -191,7 +191,7 @@ static void clear_stage2_pmd_entry(struct kvm *kvm, pmd_t *pmd, phys_addr_t addr > > VM_BUG_ON(pmd_thp_or_huge(*pmd)); > > pmd_clear(pmd); > > kvm_tlb_flush_vmid_ipa(kvm, addr); > > - pte_free_kernel(NULL, pte_table); > > + free_page((unsigned long)pte_table); > > put_page(virt_to_page(pmd)); > > } > > > > -- > > 2.20.1 > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V2] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables 2019-04-01 18:34 ` Yu Zhao @ 2019-04-02 9:03 ` Will Deacon 2019-04-08 14:22 ` Will Deacon 0 siblings, 1 reply; 9+ messages in thread From: Will Deacon @ 2019-04-02 9:03 UTC (permalink / raw) To: Yu Zhao Cc: marc.zyngier, catalin.marinas, Anshuman Khandual, linux-mm, kvmarm, linux-arm-kernel On Mon, Apr 01, 2019 at 12:34:25PM -0600, Yu Zhao wrote: > On Mon, Apr 01, 2019 at 05:16:38PM +0100, Will Deacon wrote: > > [+KVM/ARM folks, since I can't take this without an Ack in place from them] > > > > My understanding is that this patch is intended to replace patch 3/4 in > > this series: > > > > http://lists.infradead.org/pipermail/linux-arm-kernel/2019-March/638083.html > > Yes, and sorry for the confusion. I could send an updated series once > this patch is merged. Thanks. That's alright, I think I'm on top of it (but I'll ask you to check whatever I end up merging). Just wanted to make it easy for the kvm folks to dive in with no context! Will ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V2] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables 2019-04-02 9:03 ` Will Deacon @ 2019-04-08 14:22 ` Will Deacon 2019-04-08 14:22 ` Will Deacon 2019-04-08 17:18 ` Yu Zhao 0 siblings, 2 replies; 9+ messages in thread From: Will Deacon @ 2019-04-08 14:22 UTC (permalink / raw) To: Yu Zhao Cc: marc.zyngier, catalin.marinas, Anshuman Khandual, linux-mm, kvmarm, linux-arm-kernel On Tue, Apr 02, 2019 at 10:04:30AM +0100, Will Deacon wrote: > On Mon, Apr 01, 2019 at 12:34:25PM -0600, Yu Zhao wrote: > > On Mon, Apr 01, 2019 at 05:16:38PM +0100, Will Deacon wrote: > > > [+KVM/ARM folks, since I can't take this without an Ack in place from them] > > > > > > My understanding is that this patch is intended to replace patch 3/4 in > > > this series: > > > > > > http://lists.infradead.org/pipermail/linux-arm-kernel/2019-March/638083.html > > > > Yes, and sorry for the confusion. I could send an updated series once > > this patch is merged. Thanks. > > That's alright, I think I'm on top of it (but I'll ask you to check whatever > I end up merging). Just wanted to make it easy for the kvm folks to dive in > with no context! Ok, I've pushed this out onto a temporary branch before I merge it into -next: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=pgtable-ctors Please can you confirm that it looks ok? Thanks, Will ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V2] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables 2019-04-08 14:22 ` Will Deacon @ 2019-04-08 14:22 ` Will Deacon 2019-04-08 17:18 ` Yu Zhao 1 sibling, 0 replies; 9+ messages in thread From: Will Deacon @ 2019-04-08 14:22 UTC (permalink / raw) To: Yu Zhao Cc: marc.zyngier, catalin.marinas, Anshuman Khandual, linux-mm, kvmarm, linux-arm-kernel On Tue, Apr 02, 2019 at 10:04:30AM +0100, Will Deacon wrote: > On Mon, Apr 01, 2019 at 12:34:25PM -0600, Yu Zhao wrote: > > On Mon, Apr 01, 2019 at 05:16:38PM +0100, Will Deacon wrote: > > > [+KVM/ARM folks, since I can't take this without an Ack in place from them] > > > > > > My understanding is that this patch is intended to replace patch 3/4 in > > > this series: > > > > > > http://lists.infradead.org/pipermail/linux-arm-kernel/2019-March/638083.html > > > > Yes, and sorry for the confusion. I could send an updated series once > > this patch is merged. Thanks. > > That's alright, I think I'm on top of it (but I'll ask you to check whatever > I end up merging). Just wanted to make it easy for the kvm folks to dive in > with no context! Ok, I've pushed this out onto a temporary branch before I merge it into -next: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=pgtable-ctors Please can you confirm that it looks ok? Thanks, Will _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V2] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables 2019-04-08 14:22 ` Will Deacon 2019-04-08 14:22 ` Will Deacon @ 2019-04-08 17:18 ` Yu Zhao 2019-04-08 17:18 ` Yu Zhao 1 sibling, 1 reply; 9+ messages in thread From: Yu Zhao @ 2019-04-08 17:18 UTC (permalink / raw) To: Will Deacon Cc: mark.rutland, julien.thierry, suzuki.poulose, marc.zyngier, catalin.marinas, Anshuman Khandual, christoffer.dall, linux-mm, james.morse, kvmarm, linux-arm-kernel On Mon, Apr 08, 2019 at 03:22:38PM +0100, Will Deacon wrote: > On Tue, Apr 02, 2019 at 10:04:30AM +0100, Will Deacon wrote: > > On Mon, Apr 01, 2019 at 12:34:25PM -0600, Yu Zhao wrote: > > > On Mon, Apr 01, 2019 at 05:16:38PM +0100, Will Deacon wrote: > > > > [+KVM/ARM folks, since I can't take this without an Ack in place from them] > > > > > > > > My understanding is that this patch is intended to replace patch 3/4 in > > > > this series: > > > > > > > > http://lists.infradead.org/pipermail/linux-arm-kernel/2019-March/638083.html > > > > > > Yes, and sorry for the confusion. I could send an updated series once > > > this patch is merged. Thanks. > > > > That's alright, I think I'm on top of it (but I'll ask you to check whatever > > I end up merging). Just wanted to make it easy for the kvm folks to dive in > > with no context! > > Ok, I've pushed this out onto a temporary branch before I merge it into > -next: > > https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=pgtable-ctors > > Please can you confirm that it looks ok? LGTM, thanks. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V2] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables 2019-04-08 17:18 ` Yu Zhao @ 2019-04-08 17:18 ` Yu Zhao 0 siblings, 0 replies; 9+ messages in thread From: Yu Zhao @ 2019-04-08 17:18 UTC (permalink / raw) To: Will Deacon Cc: marc.zyngier, catalin.marinas, Anshuman Khandual, linux-mm, kvmarm, linux-arm-kernel On Mon, Apr 08, 2019 at 03:22:38PM +0100, Will Deacon wrote: > On Tue, Apr 02, 2019 at 10:04:30AM +0100, Will Deacon wrote: > > On Mon, Apr 01, 2019 at 12:34:25PM -0600, Yu Zhao wrote: > > > On Mon, Apr 01, 2019 at 05:16:38PM +0100, Will Deacon wrote: > > > > [+KVM/ARM folks, since I can't take this without an Ack in place from them] > > > > > > > > My understanding is that this patch is intended to replace patch 3/4 in > > > > this series: > > > > > > > > http://lists.infradead.org/pipermail/linux-arm-kernel/2019-March/638083.html > > > > > > Yes, and sorry for the confusion. I could send an updated series once > > > this patch is merged. Thanks. > > > > That's alright, I think I'm on top of it (but I'll ask you to check whatever > > I end up merging). Just wanted to make it easy for the kvm folks to dive in > > with no context! > > Ok, I've pushed this out onto a temporary branch before I merge it into > -next: > > https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=pgtable-ctors > > Please can you confirm that it looks ok? LGTM, thanks. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V2] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables 2019-04-01 16:16 ` [PATCH V2] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables Will Deacon 2019-04-01 18:34 ` Yu Zhao @ 2019-04-08 9:09 ` Marc Zyngier 2019-04-08 9:09 ` Marc Zyngier 1 sibling, 1 reply; 9+ messages in thread From: Marc Zyngier @ 2019-04-08 9:09 UTC (permalink / raw) To: Will Deacon, Anshuman Khandual Cc: yuzhao, catalin.marinas, linux-mm, kvmarm, linux-arm-kernel On 01/04/2019 17:16, Will Deacon wrote: > [+KVM/ARM folks, since I can't take this without an Ack in place from them] > > My understanding is that this patch is intended to replace patch 3/4 in > this series: > > http://lists.infradead.org/pipermail/linux-arm-kernel/2019-March/638083.html > > On Tue, Mar 12, 2019 at 06:55:45PM +0530, Anshuman Khandual wrote: >> ARM64 standard pgtable functions are going to use pgtable_page_[ctor|dtor] >> or pgtable_pmd_page_[ctor|dtor] constructs. At present KVM guest stage-2 >> PUD|PMD|PTE level page tabe pages are allocated with __get_free_page() >> via mmu_memory_cache_alloc() but released with standard pud|pmd_free() or >> pte_free_kernel(). These will fail once they start calling into pgtable_ >> [pmd]_page_dtor() for pages which never originally went through respective >> constructor functions. Hence convert all stage-2 page table page release >> functions to call buddy directly while freeing pages. >> >> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com> >> Acked-by: Yu Zhao <yuzhao@google.com> >> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> >> --- >> Changes in V2: >> >> - Updated stage2_pud_free() with NOP as per Suzuki >> - s/__free_page/free_page/ in clear_stage2_pmd_entry() for uniformity >> >> arch/arm/include/asm/stage2_pgtable.h | 4 ++-- >> arch/arm64/include/asm/stage2_pgtable.h | 4 ++-- >> virt/kvm/arm/mmu.c | 2 +- >> 3 files changed, 5 insertions(+), 5 deletions(-) >> >> diff --git a/arch/arm/include/asm/stage2_pgtable.h b/arch/arm/include/asm/stage2_pgtable.h >> index de2089501b8b..fed02c3b4600 100644 >> --- a/arch/arm/include/asm/stage2_pgtable.h >> +++ b/arch/arm/include/asm/stage2_pgtable.h >> @@ -32,14 +32,14 @@ >> #define stage2_pgd_present(kvm, pgd) pgd_present(pgd) >> #define stage2_pgd_populate(kvm, pgd, pud) pgd_populate(NULL, pgd, pud) >> #define stage2_pud_offset(kvm, pgd, address) pud_offset(pgd, address) >> -#define stage2_pud_free(kvm, pud) pud_free(NULL, pud) >> +#define stage2_pud_free(kvm, pud) do { } while (0) >> >> #define stage2_pud_none(kvm, pud) pud_none(pud) >> #define stage2_pud_clear(kvm, pud) pud_clear(pud) >> #define stage2_pud_present(kvm, pud) pud_present(pud) >> #define stage2_pud_populate(kvm, pud, pmd) pud_populate(NULL, pud, pmd) >> #define stage2_pmd_offset(kvm, pud, address) pmd_offset(pud, address) >> -#define stage2_pmd_free(kvm, pmd) pmd_free(NULL, pmd) >> +#define stage2_pmd_free(kvm, pmd) free_page((unsigned long)pmd) >> >> #define stage2_pud_huge(kvm, pud) pud_huge(pud) >> >> diff --git a/arch/arm64/include/asm/stage2_pgtable.h b/arch/arm64/include/asm/stage2_pgtable.h >> index 5412fa40825e..915809e4ac32 100644 >> --- a/arch/arm64/include/asm/stage2_pgtable.h >> +++ b/arch/arm64/include/asm/stage2_pgtable.h >> @@ -119,7 +119,7 @@ static inline pud_t *stage2_pud_offset(struct kvm *kvm, >> static inline void stage2_pud_free(struct kvm *kvm, pud_t *pud) >> { >> if (kvm_stage2_has_pud(kvm)) >> - pud_free(NULL, pud); >> + free_page((unsigned long)pud); >> } >> >> static inline bool stage2_pud_table_empty(struct kvm *kvm, pud_t *pudp) >> @@ -192,7 +192,7 @@ static inline pmd_t *stage2_pmd_offset(struct kvm *kvm, >> static inline void stage2_pmd_free(struct kvm *kvm, pmd_t *pmd) >> { >> if (kvm_stage2_has_pmd(kvm)) >> - pmd_free(NULL, pmd); >> + free_page((unsigned long)pmd); >> } >> >> static inline bool stage2_pud_huge(struct kvm *kvm, pud_t pud) >> diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c >> index e9d28a7ca673..cbfbdadca8a5 100644 >> --- a/virt/kvm/arm/mmu.c >> +++ b/virt/kvm/arm/mmu.c >> @@ -191,7 +191,7 @@ static void clear_stage2_pmd_entry(struct kvm *kvm, pmd_t *pmd, phys_addr_t addr >> VM_BUG_ON(pmd_thp_or_huge(*pmd)); >> pmd_clear(pmd); >> kvm_tlb_flush_vmid_ipa(kvm, addr); >> - pte_free_kernel(NULL, pte_table); >> + free_page((unsigned long)pte_table); >> put_page(virt_to_page(pmd)); >> } >> >> -- >> 2.20.1 >> Looks good to me, please take it via the arm64 tree with my Acked-by: Marc Zyngier <marc.zyngier@arm.com> Thanks, M. -- Jazz is not dead. It just smells funny... ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V2] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables 2019-04-08 9:09 ` Marc Zyngier @ 2019-04-08 9:09 ` Marc Zyngier 0 siblings, 0 replies; 9+ messages in thread From: Marc Zyngier @ 2019-04-08 9:09 UTC (permalink / raw) To: Will Deacon, Anshuman Khandual Cc: yuzhao, catalin.marinas, linux-mm, kvmarm, linux-arm-kernel On 01/04/2019 17:16, Will Deacon wrote: > [+KVM/ARM folks, since I can't take this without an Ack in place from them] > > My understanding is that this patch is intended to replace patch 3/4 in > this series: > > http://lists.infradead.org/pipermail/linux-arm-kernel/2019-March/638083.html > > On Tue, Mar 12, 2019 at 06:55:45PM +0530, Anshuman Khandual wrote: >> ARM64 standard pgtable functions are going to use pgtable_page_[ctor|dtor] >> or pgtable_pmd_page_[ctor|dtor] constructs. At present KVM guest stage-2 >> PUD|PMD|PTE level page tabe pages are allocated with __get_free_page() >> via mmu_memory_cache_alloc() but released with standard pud|pmd_free() or >> pte_free_kernel(). These will fail once they start calling into pgtable_ >> [pmd]_page_dtor() for pages which never originally went through respective >> constructor functions. Hence convert all stage-2 page table page release >> functions to call buddy directly while freeing pages. >> >> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com> >> Acked-by: Yu Zhao <yuzhao@google.com> >> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> >> --- >> Changes in V2: >> >> - Updated stage2_pud_free() with NOP as per Suzuki >> - s/__free_page/free_page/ in clear_stage2_pmd_entry() for uniformity >> >> arch/arm/include/asm/stage2_pgtable.h | 4 ++-- >> arch/arm64/include/asm/stage2_pgtable.h | 4 ++-- >> virt/kvm/arm/mmu.c | 2 +- >> 3 files changed, 5 insertions(+), 5 deletions(-) >> >> diff --git a/arch/arm/include/asm/stage2_pgtable.h b/arch/arm/include/asm/stage2_pgtable.h >> index de2089501b8b..fed02c3b4600 100644 >> --- a/arch/arm/include/asm/stage2_pgtable.h >> +++ b/arch/arm/include/asm/stage2_pgtable.h >> @@ -32,14 +32,14 @@ >> #define stage2_pgd_present(kvm, pgd) pgd_present(pgd) >> #define stage2_pgd_populate(kvm, pgd, pud) pgd_populate(NULL, pgd, pud) >> #define stage2_pud_offset(kvm, pgd, address) pud_offset(pgd, address) >> -#define stage2_pud_free(kvm, pud) pud_free(NULL, pud) >> +#define stage2_pud_free(kvm, pud) do { } while (0) >> >> #define stage2_pud_none(kvm, pud) pud_none(pud) >> #define stage2_pud_clear(kvm, pud) pud_clear(pud) >> #define stage2_pud_present(kvm, pud) pud_present(pud) >> #define stage2_pud_populate(kvm, pud, pmd) pud_populate(NULL, pud, pmd) >> #define stage2_pmd_offset(kvm, pud, address) pmd_offset(pud, address) >> -#define stage2_pmd_free(kvm, pmd) pmd_free(NULL, pmd) >> +#define stage2_pmd_free(kvm, pmd) free_page((unsigned long)pmd) >> >> #define stage2_pud_huge(kvm, pud) pud_huge(pud) >> >> diff --git a/arch/arm64/include/asm/stage2_pgtable.h b/arch/arm64/include/asm/stage2_pgtable.h >> index 5412fa40825e..915809e4ac32 100644 >> --- a/arch/arm64/include/asm/stage2_pgtable.h >> +++ b/arch/arm64/include/asm/stage2_pgtable.h >> @@ -119,7 +119,7 @@ static inline pud_t *stage2_pud_offset(struct kvm *kvm, >> static inline void stage2_pud_free(struct kvm *kvm, pud_t *pud) >> { >> if (kvm_stage2_has_pud(kvm)) >> - pud_free(NULL, pud); >> + free_page((unsigned long)pud); >> } >> >> static inline bool stage2_pud_table_empty(struct kvm *kvm, pud_t *pudp) >> @@ -192,7 +192,7 @@ static inline pmd_t *stage2_pmd_offset(struct kvm *kvm, >> static inline void stage2_pmd_free(struct kvm *kvm, pmd_t *pmd) >> { >> if (kvm_stage2_has_pmd(kvm)) >> - pmd_free(NULL, pmd); >> + free_page((unsigned long)pmd); >> } >> >> static inline bool stage2_pud_huge(struct kvm *kvm, pud_t pud) >> diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c >> index e9d28a7ca673..cbfbdadca8a5 100644 >> --- a/virt/kvm/arm/mmu.c >> +++ b/virt/kvm/arm/mmu.c >> @@ -191,7 +191,7 @@ static void clear_stage2_pmd_entry(struct kvm *kvm, pmd_t *pmd, phys_addr_t addr >> VM_BUG_ON(pmd_thp_or_huge(*pmd)); >> pmd_clear(pmd); >> kvm_tlb_flush_vmid_ipa(kvm, addr); >> - pte_free_kernel(NULL, pte_table); >> + free_page((unsigned long)pte_table); >> put_page(virt_to_page(pmd)); >> } >> >> -- >> 2.20.1 >> Looks good to me, please take it via the arm64 tree with my Acked-by: Marc Zyngier <marc.zyngier@arm.com> Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-04-08 19:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <3be0b7e0-2ef8-babb-88c9-d229e0fdd220@arm.com>
[not found] ` <1552397145-10665-1-git-send-email-anshuman.khandual@arm.com>
2019-04-01 16:16 ` [PATCH V2] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables Will Deacon
2019-04-01 18:34 ` Yu Zhao
2019-04-02 9:03 ` Will Deacon
2019-04-08 14:22 ` Will Deacon
2019-04-08 14:22 ` Will Deacon
2019-04-08 17:18 ` Yu Zhao
2019-04-08 17:18 ` Yu Zhao
2019-04-08 9:09 ` Marc Zyngier
2019-04-08 9:09 ` Marc Zyngier
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox