From: Huangzhaoyang <huangzhaoyang@gmail.com>
To: Ard Biesheuvel <ardb@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Anshuman Khandual <anshuman.khandual@arm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Nicholas Piggin <npiggin@gmail.com>,
Mike Rapoport <rppt@kernel.org>,
Pavel Tatashin <pasha.tatashin@soleen.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Jonathan Marek <jonathan@marek.ca>,
Zhaoyang Huang <zhaoyang.huang@unisoc.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH] arch: arm64: have memblocks out of kernel text use section map
Date: Fri, 12 Nov 2021 17:20:42 +0800 [thread overview]
Message-ID: <1636708842-25787-1-git-send-email-huangzhaoyang@gmail.com> (raw)
From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
By comparing the swapper_pg_dir with k54 and previous versions,we find
that the linear mappings within which the addr is out of kernel text section
will use the smallest pte. It should arise for the sake of rodata_full, which
set all memblock use NO_CONT_MAPPINGS.
Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
---
arch/arm64/mm/mmu.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index cfd9deb..14e1bea 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -252,6 +252,8 @@ static void init_pmd(pud_t *pudp, unsigned long addr, unsigned long end,
pmd_clear_fixmap();
}
+static bool crash_mem_map __initdata;
+
static void alloc_init_cont_pmd(pud_t *pudp, unsigned long addr,
unsigned long end, phys_addr_t phys,
pgprot_t prot,
@@ -259,7 +261,15 @@ static void alloc_init_cont_pmd(pud_t *pudp, unsigned long addr,
{
unsigned long next;
pud_t pud = READ_ONCE(*pudp);
+ unsigned long len = end - addr;
+ phys_addr_t kernel_start = __pa_symbol(_stext);
+ phys_addr_t kernel_end = __pa_symbol(__init_begin);
+ if (debug_pagealloc_enabled() || crash_mem_map || IS_ENABLED(CONFIG_KFENCE))
+ ;
+ else if (phys > kernel_end || phys + len < kernel_start) {
+ flags &= ~(NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS);
+ }
/*
* Check for initial section mappings in the pgd/pud.
*/
@@ -483,7 +493,6 @@ void __init mark_linear_text_alias_ro(void)
PAGE_KERNEL_RO);
}
-static bool crash_mem_map __initdata;
static int __init enable_crash_mem_map(char *arg)
{
--
1.9.1
next reply other threads:[~2021-11-12 9:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-12 9:20 Huangzhaoyang [this message]
2021-11-12 9:31 ` Ard Biesheuvel
2021-11-12 9:45 ` Zhaoyang Huang
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=1636708842-25787-1-git-send-email-huangzhaoyang@gmail.com \
--to=huangzhaoyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=jonathan@marek.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=npiggin@gmail.com \
--cc=pasha.tatashin@soleen.com \
--cc=rppt@kernel.org \
--cc=will@kernel.org \
--cc=zhaoyang.huang@unisoc.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