* [PATCH 0/2] arm64 lpa2 fixes
@ 2024-03-01 10:40 Ard Biesheuvel
2024-03-01 10:40 ` [PATCH 1/2] arm64/mm: Use generic __pud_free() helper in pud_free() implementation Ard Biesheuvel
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2024-03-01 10:40 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: catalin.marinas, will, Ard Biesheuvel
From: Ard Biesheuvel <ardb@kernel.org>
A couple of fixes for the LPA2 code queued up in arm64/for-next.
Ard Biesheuvel (2):
arm64/mm: Use generic __pud_free() helper in pud_free() implementation
arm64/mm: Avoid ID mapping of kpti flag if it is no longer needed
arch/arm64/include/asm/pgalloc.h | 3 +--
arch/arm64/mm/mmu.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
--
2.44.0.278.ge034bb2e1d-goog
_______________________________________________
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] 5+ messages in thread
* [PATCH 1/2] arm64/mm: Use generic __pud_free() helper in pud_free() implementation
2024-03-01 10:40 [PATCH 0/2] arm64 lpa2 fixes Ard Biesheuvel
@ 2024-03-01 10:40 ` Ard Biesheuvel
2024-03-01 10:46 ` Ryan Roberts
2024-03-01 10:40 ` [PATCH 2/2] arm64/mm: Avoid ID mapping of kpti flag if it is no longer needed Ard Biesheuvel
2024-03-01 18:29 ` [PATCH 0/2] arm64 lpa2 fixes Catalin Marinas
2 siblings, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2024-03-01 10:40 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: catalin.marinas, will, Ard Biesheuvel, Ryan Roberts
From: Ard Biesheuvel <ardb@kernel.org>
Commit 0dd4f60a2c76 ("arm64: mm: Add support for folding PUDs at
runtime") implements specialized PUD alloc/free helpers to allow the
decision whether or not to fold PUDs to be made at runtime when the
number of paging levels is 4 or higher.
Its implementation of pud_free() is based on the generic version that
existed when the patch was first written, but in the meantime, the
freeing of a PUD has become a bit more involved, and so instead of
simply freeing the page, we should invoke the generic __pud_free() that
encapsulates whatever needs doing at this point.
This fixes a reported warning emitted by the page flags
self-diagnostics.
Reported-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/arm64/include/asm/pgalloc.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h
index aeba2cf15a25..8ff5f2a2579e 100644
--- a/arch/arm64/include/asm/pgalloc.h
+++ b/arch/arm64/include/asm/pgalloc.h
@@ -60,8 +60,7 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud)
{
if (!pgtable_l4_enabled())
return;
- BUG_ON((unsigned long)pud & (PAGE_SIZE-1));
- free_page((unsigned long)pud);
+ __pud_free(mm, pud);
}
#else
static inline void __p4d_populate(p4d_t *p4dp, phys_addr_t pudp, p4dval_t prot)
--
2.44.0.278.ge034bb2e1d-goog
_______________________________________________
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] 5+ messages in thread
* [PATCH 2/2] arm64/mm: Avoid ID mapping of kpti flag if it is no longer needed
2024-03-01 10:40 [PATCH 0/2] arm64 lpa2 fixes Ard Biesheuvel
2024-03-01 10:40 ` [PATCH 1/2] arm64/mm: Use generic __pud_free() helper in pud_free() implementation Ard Biesheuvel
@ 2024-03-01 10:40 ` Ard Biesheuvel
2024-03-01 18:29 ` [PATCH 0/2] arm64 lpa2 fixes Catalin Marinas
2 siblings, 0 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2024-03-01 10:40 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: catalin.marinas, will, Ard Biesheuvel
From: Ard Biesheuvel <ardb@kernel.org>
arm64_use_ng_mappings will be set to 'true' by the early boot code if it
decides to use non-global (nG) attributes for all kernel mappings,
typically when enabling KASLR on a system that does not implement E0PD.
In this case, the G-to-nG update routines are never called, and so there
is no reason to create the writable mapping of the associated status
flag in the ID map.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/arm64/mm/mmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index b131ed31a6c8..bf5b1c426ad0 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -777,7 +777,7 @@ static void __init create_idmap(void)
IDMAP_ROOT_LEVEL, (pte_t *)idmap_pg_dir, false,
__phys_to_virt(ptep) - ptep);
- if (IS_ENABLED(CONFIG_UNMAP_KERNEL_AT_EL0)) {
+ if (IS_ENABLED(CONFIG_UNMAP_KERNEL_AT_EL0) && !arm64_use_ng_mappings) {
extern u32 __idmap_kpti_flag;
u64 pa = __pa_symbol(&__idmap_kpti_flag);
--
2.44.0.278.ge034bb2e1d-goog
_______________________________________________
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] 5+ messages in thread
* Re: [PATCH 1/2] arm64/mm: Use generic __pud_free() helper in pud_free() implementation
2024-03-01 10:40 ` [PATCH 1/2] arm64/mm: Use generic __pud_free() helper in pud_free() implementation Ard Biesheuvel
@ 2024-03-01 10:46 ` Ryan Roberts
0 siblings, 0 replies; 5+ messages in thread
From: Ryan Roberts @ 2024-03-01 10:46 UTC (permalink / raw)
To: Ard Biesheuvel, linux-arm-kernel; +Cc: catalin.marinas, will, Ard Biesheuvel
On 01/03/2024 10:40, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@kernel.org>
>
> Commit 0dd4f60a2c76 ("arm64: mm: Add support for folding PUDs at
> runtime") implements specialized PUD alloc/free helpers to allow the
> decision whether or not to fold PUDs to be made at runtime when the
> number of paging levels is 4 or higher.
>
> Its implementation of pud_free() is based on the generic version that
> existed when the patch was first written, but in the meantime, the
> freeing of a PUD has become a bit more involved, and so instead of
> simply freeing the page, we should invoke the generic __pud_free() that
> encapsulates whatever needs doing at this point.
>
> This fixes a reported warning emitted by the page flags
> self-diagnostics.
>
> Reported-by: Ryan Roberts <ryan.roberts@arm.com>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Ryan Roberts <ryan.roberts@arm.com>
> ---
> arch/arm64/include/asm/pgalloc.h | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h
> index aeba2cf15a25..8ff5f2a2579e 100644
> --- a/arch/arm64/include/asm/pgalloc.h
> +++ b/arch/arm64/include/asm/pgalloc.h
> @@ -60,8 +60,7 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud)
> {
> if (!pgtable_l4_enabled())
> return;
> - BUG_ON((unsigned long)pud & (PAGE_SIZE-1));
> - free_page((unsigned long)pud);
> + __pud_free(mm, pud);
> }
> #else
> static inline void __p4d_populate(p4d_t *p4dp, phys_addr_t pudp, p4dval_t 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] 5+ messages in thread
* Re: [PATCH 0/2] arm64 lpa2 fixes
2024-03-01 10:40 [PATCH 0/2] arm64 lpa2 fixes Ard Biesheuvel
2024-03-01 10:40 ` [PATCH 1/2] arm64/mm: Use generic __pud_free() helper in pud_free() implementation Ard Biesheuvel
2024-03-01 10:40 ` [PATCH 2/2] arm64/mm: Avoid ID mapping of kpti flag if it is no longer needed Ard Biesheuvel
@ 2024-03-01 18:29 ` Catalin Marinas
2 siblings, 0 replies; 5+ messages in thread
From: Catalin Marinas @ 2024-03-01 18:29 UTC (permalink / raw)
To: linux-arm-kernel, Ard Biesheuvel; +Cc: Will Deacon, Ard Biesheuvel
On Fri, 01 Mar 2024 11:40:47 +0100, Ard Biesheuvel wrote:
> A couple of fixes for the LPA2 code queued up in arm64/for-next.
>
>
> Ard Biesheuvel (2):
> arm64/mm: Use generic __pud_free() helper in pud_free() implementation
> arm64/mm: Avoid ID mapping of kpti flag if it is no longer needed
>
> [...]
Applied to arm64 (for-next/stage1-lpa2), thanks!
[1/2] arm64/mm: Use generic __pud_free() helper in pud_free() implementation
https://git.kernel.org/arm64/c/3137db4c66bf
[2/2] arm64/mm: Avoid ID mapping of kpti flag if it is no longer needed
https://git.kernel.org/arm64/c/27f2b9fcddc7
--
Catalin
_______________________________________________
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] 5+ messages in thread
end of thread, other threads:[~2024-03-01 18:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-01 10:40 [PATCH 0/2] arm64 lpa2 fixes Ard Biesheuvel
2024-03-01 10:40 ` [PATCH 1/2] arm64/mm: Use generic __pud_free() helper in pud_free() implementation Ard Biesheuvel
2024-03-01 10:46 ` Ryan Roberts
2024-03-01 10:40 ` [PATCH 2/2] arm64/mm: Avoid ID mapping of kpti flag if it is no longer needed Ard Biesheuvel
2024-03-01 18:29 ` [PATCH 0/2] arm64 lpa2 fixes Catalin Marinas
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).