* [PATCH] arm64/mm: Drop SECTION_[SHIFT|SIZE|MASK]
@ 2021-06-14 8:18 ` Anshuman Khandual
0 siblings, 0 replies; 8+ messages in thread
From: Anshuman Khandual @ 2021-06-14 8:18 UTC (permalink / raw
To: linux-arm-kernel
Cc: Anshuman Khandual, Catalin Marinas, Will Deacon, Mark Rutland,
linux-kernel
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(-)
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);
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] arm64/mm: Drop SECTION_[SHIFT|SIZE|MASK]
2021-06-14 8:18 ` Anshuman Khandual
@ 2021-06-14 12:40 ` Gavin Shan
-1 siblings, 0 replies; 8+ messages in thread
From: Gavin Shan @ 2021-06-14 12:40 UTC (permalink / raw
To: Anshuman Khandual, linux-arm-kernel
Cc: Catalin Marinas, Will Deacon, Mark Rutland, linux-kernel
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);
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] arm64/mm: Drop SECTION_[SHIFT|SIZE|MASK]
@ 2021-06-14 12:40 ` Gavin Shan
0 siblings, 0 replies; 8+ messages in thread
From: Gavin Shan @ 2021-06-14 12:40 UTC (permalink / raw
To: Anshuman Khandual, linux-arm-kernel
Cc: Catalin Marinas, Will Deacon, Mark Rutland, linux-kernel
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);
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] arm64/mm: Drop SECTION_[SHIFT|SIZE|MASK]
2021-06-14 8:18 ` Anshuman Khandual
@ 2021-06-14 15:21 ` Catalin Marinas
-1 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2021-06-14 15:21 UTC (permalink / raw
To: Anshuman Khandual
Cc: linux-arm-kernel, Will Deacon, Mark Rutland, linux-kernel
On Mon, Jun 14, 2021 at 01:48:26PM +0530, 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>
The clean-up looks good to me:
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] arm64/mm: Drop SECTION_[SHIFT|SIZE|MASK]
@ 2021-06-14 15:21 ` Catalin Marinas
0 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2021-06-14 15:21 UTC (permalink / raw
To: Anshuman Khandual
Cc: linux-arm-kernel, Will Deacon, Mark Rutland, linux-kernel
On Mon, Jun 14, 2021 at 01:48:26PM +0530, 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>
The clean-up looks good to me:
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] arm64/mm: Drop SECTION_[SHIFT|SIZE|MASK]
2021-06-14 8:18 ` Anshuman Khandual
@ 2021-06-15 12:06 ` Will Deacon
-1 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2021-06-15 12:06 UTC (permalink / raw
To: Anshuman Khandual, linux-arm-kernel
Cc: catalin.marinas, kernel-team, Will Deacon, Mark Rutland,
linux-kernel
On Mon, 14 Jun 2021 13:48:26 +0530, 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.
Applied to arm64 (for-next/mm), thanks!
[1/1] arm64/mm: Drop SECTION_[SHIFT|SIZE|MASK]
https://git.kernel.org/arm64/c/4aaa87ab3d2d
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] arm64/mm: Drop SECTION_[SHIFT|SIZE|MASK]
@ 2021-06-15 12:06 ` Will Deacon
0 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2021-06-15 12:06 UTC (permalink / raw
To: Anshuman Khandual, linux-arm-kernel
Cc: catalin.marinas, kernel-team, Will Deacon, Mark Rutland,
linux-kernel
On Mon, 14 Jun 2021 13:48:26 +0530, 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.
Applied to arm64 (for-next/mm), thanks!
[1/1] arm64/mm: Drop SECTION_[SHIFT|SIZE|MASK]
https://git.kernel.org/arm64/c/4aaa87ab3d2d
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread