From: Marc Zyngier <marc.zyngier@arm.com>
To: Will Deacon <will.deacon@arm.com>,
Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org,
catalin.marinas@arm.com, mark.rutland@arm.com, yuzhao@google.com,
suzuki.poulose@arm.com, christoffer.dall@arm.com,
james.morse@arm.com, julien.thierry@arm.com,
kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH V2] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables
Date: Mon, 8 Apr 2019 10:09:25 +0100 [thread overview]
Message-ID: <77aaaaca-f9fb-cbad-74f6-e3bd159e7b37@arm.com> (raw)
In-Reply-To: <20190401161638.GB22092@fuggles.cambridge.arm.com>
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...
next prev parent reply other threads:[~2019-04-08 9:09 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-14 21:16 [PATCH] arm64: mm: enable per pmd page table lock Yu Zhao
2019-02-18 15:12 ` Will Deacon
2019-02-18 19:49 ` Yu Zhao
2019-02-18 20:48 ` Yu Zhao
2019-02-19 4:09 ` Anshuman Khandual
2019-02-18 23:13 ` [PATCH v2 1/3] arm64: mm: use appropriate ctors for page tables Yu Zhao
2019-02-18 23:13 ` [PATCH v2 2/3] arm64: mm: don't call page table ctors for init_mm Yu Zhao
2019-02-26 15:13 ` Mark Rutland
2019-03-09 3:52 ` Yu Zhao
2019-02-18 23:13 ` [PATCH v2 3/3] arm64: mm: enable per pmd page table lock Yu Zhao
2019-02-19 4:21 ` [PATCH v2 1/3] arm64: mm: use appropriate ctors for page tables Anshuman Khandual
2019-02-19 5:32 ` Yu Zhao
2019-02-19 6:17 ` Anshuman Khandual
2019-02-19 22:28 ` Yu Zhao
2019-02-20 10:27 ` Anshuman Khandual
2019-02-20 12:24 ` Matthew Wilcox
2019-02-20 20:22 ` Yu Zhao
2019-02-20 20:59 ` Matthew Wilcox
2019-02-20 1:34 ` Matthew Wilcox
2019-02-20 3:20 ` Anshuman Khandual
2019-02-20 21:03 ` Matthew Wilcox
2019-02-26 15:12 ` Mark Rutland
2019-03-09 4:01 ` Yu Zhao
2019-03-10 1:19 ` [PATCH v3 " Yu Zhao
2019-03-10 1:19 ` [PATCH v3 2/3] arm64: mm: don't call page table ctors for init_mm Yu Zhao
2019-03-10 1:19 ` [PATCH v3 3/3] arm64: mm: enable per pmd page table lock Yu Zhao
2019-03-11 8:28 ` Anshuman Khandual
2019-03-11 23:10 ` Yu Zhao
2019-03-11 12:12 ` Mark Rutland
2019-03-11 12:57 ` Anshuman Khandual
2019-03-11 23:11 ` Yu Zhao
2019-03-11 7:45 ` [PATCH v3 1/3] arm64: mm: use appropriate ctors for page tables Anshuman Khandual
2019-03-11 23:23 ` Yu Zhao
2019-03-12 0:57 ` [PATCH v4 1/4] " Yu Zhao
2019-03-12 0:57 ` [PATCH v4 2/4] arm64: mm: don't call page table ctors for init_mm Yu Zhao
2019-03-12 0:57 ` [PATCH v4 3/4] arm64: mm: call ctor for stage2 pmd page Yu Zhao
2019-03-12 2:19 ` [PATCH] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables Anshuman Khandual
2019-03-12 2:40 ` Yu Zhao
2019-03-12 10:37 ` Suzuki K Poulose
2019-03-12 11:31 ` Anshuman Khandual
2019-03-12 11:43 ` Suzuki K Poulose
2019-03-12 13:25 ` [PATCH V2] " Anshuman Khandual
2019-04-01 16:16 ` 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 17:18 ` Yu Zhao
2019-04-08 9:09 ` Marc Zyngier [this message]
2019-03-12 0:57 ` [PATCH v4 4/4] arm64: mm: enable per pmd page table lock Yu Zhao
2019-02-19 3:08 ` [PATCH] " Anshuman Khandual
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=77aaaaca-f9fb-cbad-74f6-e3bd159e7b37@arm.com \
--to=marc.zyngier@arm.com \
--cc=anshuman.khandual@arm.com \
--cc=catalin.marinas@arm.com \
--cc=christoffer.dall@arm.com \
--cc=james.morse@arm.com \
--cc=julien.thierry@arm.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=mark.rutland@arm.com \
--cc=suzuki.poulose@arm.com \
--cc=will.deacon@arm.com \
--cc=yuzhao@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).