From: Will Deacon <will.deacon@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: mark.rutland@arm.com, Steve.Capper@arm.com, marc.zyngier@arm.com,
Catalin.Marinas@arm.com, suzuki.poulose@arm.com,
james.morse@arm.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/6] arm64/mm: Make pgd_pgtable_alloc() call pte_alloc_one() always
Date: Thu, 14 Feb 2019 17:11:01 +0000 [thread overview]
Message-ID: <20190214171101.GD2475@fuggles.cambridge.arm.com> (raw)
In-Reply-To: <1548307220-19756-4-git-send-email-anshuman.khandual@arm.com>
On Thu, Jan 24, 2019 at 10:50:17AM +0530, Anshuman Khandual wrote:
> pgd_pgtable_alloc() provides page allocation function while creating all
> levels of page table (e.g PGD, PUD, CONT PMD) for various kernel mappings.
> It calls __get_free_page() and initializes page with pagetable_page_ctor().
> pte_alloc_one() already provides a standard interface for allocating a page
> table page and initializes it with pagetable_page_ctor(). This removes the
> redundancy and instead make it call pte_alloc_one() directly.
>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> arch/arm64/mm/mmu.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index b6f5aa5..2dbd723 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -372,13 +372,22 @@ static void __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys,
>
> static phys_addr_t pgd_pgtable_alloc(void)
> {
> - void *ptr = (void *)__get_free_page(PGALLOC_GFP);
> - if (!ptr || !pgtable_page_ctor(virt_to_page(ptr)))
> - BUG();
> +
> + pgtable_t ptr;
> +
> + /*
> + * pgd_pgtable_alloc() is called while creating kernel mappings
> + * through __create_pgd_mapping() might not install it through
> + * swapper_pg_dir (&init_mm). Even then init_mm is passed here
> + * just to indicate that the allocation is kernel specific not
> + * for the user space page tables.
> + */
> + ptr = pte_alloc_one(&init_mm);
> + BUG_ON(!ptr);
>
> /* Ensure the zeroed page is visible to the page table walker */
> dsb(ishst);
> - return __pa(ptr);
> + return page_to_phys(ptr);
Are you sure this is safe? afaict, this code is used to set up the linear
mapping which happens before the mem_map is initialised. I don't think
page_to_phys() can be used at this point. What am I missing?
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-02-14 17:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-24 5:20 [PATCH 0/6] arm64/mm: Enable accounting for page table pages Anshuman Khandual
2019-01-24 5:20 ` [PATCH 1/6] KVM: ARM: Remove pgtable standard functions from stage-2 page tables Anshuman Khandual
2019-01-24 5:20 ` [PATCH 2/6] arm64/mm: Ensure PGD kmem cache object is actually allocated Anshuman Khandual
2019-01-24 15:16 ` Catalin Marinas
2019-01-25 4:59 ` Anshuman Khandual
2019-01-24 5:20 ` [PATCH 3/6] arm64/mm: Make pgd_pgtable_alloc() call pte_alloc_one() always Anshuman Khandual
2019-02-14 17:11 ` Will Deacon [this message]
2019-02-19 4:33 ` Anshuman Khandual
2019-01-24 5:20 ` [PATCH 4/6] arm64/mm: Make all page table pages cycles through standard constructs Anshuman Khandual
2019-01-24 5:20 ` [PATCH 5/6] arm64/mm: Call pgtable_page_dtor() for both PMD and PUD page table pages Anshuman Khandual
2019-02-14 17:11 ` Will Deacon
2019-02-19 4:34 ` Anshuman Khandual
2019-01-24 5:20 ` [PATCH 6/6] arm64/mm: Enable page table page accounting for user space Anshuman Khandual
2019-02-14 17:11 ` Will Deacon
2019-02-19 4:49 ` 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=20190214171101.GD2475@fuggles.cambridge.arm.com \
--to=will.deacon@arm.com \
--cc=Catalin.Marinas@arm.com \
--cc=Steve.Capper@arm.com \
--cc=anshuman.khandual@arm.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=suzuki.poulose@arm.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).