From: Gavin Shan <gshan@redhat.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>,
linux-arm-kernel@lists.infradead.org
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64/mm: Drop SECTION_[SHIFT|SIZE|MASK]
Date: Mon, 14 Jun 2021 22:40:17 +1000 [thread overview]
Message-ID: <e1d44fda-3e3b-531e-eeff-ce061abd2487@redhat.com> (raw)
In-Reply-To: <1623658706-7182-1-git-send-email-anshuman.khandual@arm.com>
On 6/14/21 6:18 PM, Anshuman Khandual wrote:
> SECTION_[SHIFT|SIZE|MASK] are essentially PMD_[SHIFT|SIZE|MASK]. But these
> create confusion being similar to generic sparsemem memory sections, which
> are derived from SECTION_SIZE_BITS. Section references have always implied
> PMD level block mapping. Instead just use all PMD level macros which would
> make it explicit and also remove confusion with sparsmem memory sections.
>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> This applies on v5.13-rc6.
>
> arch/arm64/include/asm/kernel-pgtable.h | 4 ++--
> arch/arm64/include/asm/pgtable-hwdef.h | 7 -------
> arch/arm64/mm/mmu.c | 2 +-
> 3 files changed, 3 insertions(+), 10 deletions(-)
>
It does introduce confusion to sparsemem section. The changes look
good to me:
Reviewed-by: Gavin Shan <gshan@redhat.com>
> diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h
> index d44df9d62fc9..88b8d681ad91 100644
> --- a/arch/arm64/include/asm/kernel-pgtable.h
> +++ b/arch/arm64/include/asm/kernel-pgtable.h
> @@ -91,8 +91,8 @@
>
> /* Initial memory map size */
> #if ARM64_SWAPPER_USES_SECTION_MAPS
> -#define SWAPPER_BLOCK_SHIFT SECTION_SHIFT
> -#define SWAPPER_BLOCK_SIZE SECTION_SIZE
> +#define SWAPPER_BLOCK_SHIFT PMD_SHIFT
> +#define SWAPPER_BLOCK_SIZE PMD_SIZE
> #define SWAPPER_TABLE_SHIFT PUD_SHIFT
> #else
> #define SWAPPER_BLOCK_SHIFT PAGE_SHIFT
> diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h
> index b82575a33f8b..40085e53f573 100644
> --- a/arch/arm64/include/asm/pgtable-hwdef.h
> +++ b/arch/arm64/include/asm/pgtable-hwdef.h
> @@ -71,13 +71,6 @@
> #define PGDIR_MASK (~(PGDIR_SIZE-1))
> #define PTRS_PER_PGD (1 << (VA_BITS - PGDIR_SHIFT))
>
> -/*
> - * Section address mask and size definitions.
> - */
> -#define SECTION_SHIFT PMD_SHIFT
> -#define SECTION_SIZE (_AC(1, UL) << SECTION_SHIFT)
> -#define SECTION_MASK (~(SECTION_SIZE-1))
> -
> /*
> * Contiguous page definitions.
> */
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 89b66ef43a0f..380771610dd2 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -228,7 +228,7 @@ static void init_pmd(pud_t *pudp, unsigned long addr, unsigned long end,
> next = pmd_addr_end(addr, end);
>
> /* try section mapping first */
> - if (((addr | next | phys) & ~SECTION_MASK) == 0 &&
> + if (((addr | next | phys) & ~PMD_MASK) == 0 &&
> (flags & NO_BLOCK_MAPPINGS) == 0) {
> pmd_set_huge(pmdp, phys, prot);
>
>
next prev parent reply other threads:[~2021-06-14 10:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-14 8:18 [PATCH] arm64/mm: Drop SECTION_[SHIFT|SIZE|MASK] Anshuman Khandual
2021-06-14 12:40 ` Gavin Shan [this message]
2021-06-14 15:21 ` Catalin Marinas
2021-06-15 12:06 ` Will Deacon
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=e1d44fda-3e3b-531e-eeff-ce061abd2487@redhat.com \
--to=gshan@redhat.com \
--cc=anshuman.khandual@arm.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=will@kernel.org \
/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