From: Mike Rapoport <rppt@kernel.org>
To: linux-arm-kernel@lists.infradead.org
Cc: Ard Biesheuvel <ardb@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Guanghui Feng <guanghuifeng@linux.alibaba.com>,
Mark Rutland <mark.rutland@arm.com>,
Mike Rapoport <rppt@kernel.org>,
Mike Rapoport <rppt@linux.ibm.com>, Will Deacon <will@kernel.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 5/5] arm64/mmu: simplify logic around crash kernel mapping in map_mem()
Date: Fri, 19 Aug 2022 07:11:56 +0300 [thread overview]
Message-ID: <20220819041156.873873-6-rppt@kernel.org> (raw)
In-Reply-To: <20220819041156.873873-1-rppt@kernel.org>
From: Mike Rapoport <rppt@linux.ibm.com>
The check for crashkernel command line parameter and presence of
CONFIG_ZONE_DMA[32] in mmu::map_mem() are not necessary because
crashk_res.end would be set by the time map_mem() runs only if
reserve_crashkernel() was called from arm64_memblock_init() and only if
there was proper crashkernel parameter in the command line.
Leave only check that crashk_res.end is non-zero to decide whether
crash kernel memory should be mapped with base pages.
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
arch/arm64/mm/mmu.c | 44 ++++++++++++--------------------------------
1 file changed, 12 insertions(+), 32 deletions(-)
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 83f2f18f7f34..fa23cfa6b772 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -502,21 +502,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)
-{
- /*
- * Proper parameter parsing is done by reserve_crashkernel(). We only
- * need to know if the linear map has to avoid block mappings so that
- * the crashkernel reservations can be unmapped later.
- */
- crash_mem_map = true;
-
- return 0;
-}
-early_param("crashkernel", enable_crash_mem_map);
-
static void __init map_mem(pgd_t *pgdp)
{
static const u64 direct_map_end = _PAGE_END(VA_BITS_MIN);
@@ -547,11 +532,9 @@ static void __init map_mem(pgd_t *pgdp)
memblock_mark_nomap(kernel_start, kernel_end - kernel_start);
#ifdef CONFIG_KEXEC_CORE
- if (crash_mem_map && !have_zone_dma()) {
- if (crashk_res.end)
- memblock_mark_nomap(crashk_res.start,
- resource_size(&crashk_res));
- }
+ if (crashk_res.end)
+ memblock_mark_nomap(crashk_res.start,
+ resource_size(&crashk_res));
#endif
/* map all the memory banks */
@@ -582,20 +565,17 @@ static void __init map_mem(pgd_t *pgdp)
memblock_clear_nomap(kernel_start, kernel_end - kernel_start);
/*
- * Use page-level mappings here so that we can shrink the region
- * in page granularity and put back unused memory to buddy system
- * through /sys/kernel/kexec_crash_size interface.
+ * Use page-level mappings here so that we can protect crash kernel
+ * memory to allow post-mortem analysis when things go awry.
*/
#ifdef CONFIG_KEXEC_CORE
- if (crash_mem_map && !have_zone_dma()) {
- if (crashk_res.end) {
- __map_memblock(pgdp, crashk_res.start,
- crashk_res.end + 1,
- PAGE_KERNEL,
- NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS);
- memblock_clear_nomap(crashk_res.start,
- resource_size(&crashk_res));
- }
+ if (crashk_res.end) {
+ __map_memblock(pgdp, crashk_res.start,
+ crashk_res.end + 1,
+ PAGE_KERNEL,
+ NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS);
+ memblock_clear_nomap(crashk_res.start,
+ resource_size(&crashk_res));
}
#endif
}
--
2.35.3
next prev parent reply other threads:[~2022-08-19 4:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-19 4:11 [PATCH 0/5] arm64/mm: remap crash kernel with base pages even if rodata_full disabled Mike Rapoport
2022-08-19 4:11 ` [PATCH 1/5] arm64: rename defer_reserve_crashkernel() to have_zone_dma() Mike Rapoport
2022-08-19 4:11 ` [PATCH 2/5] arm64/mmu: drop _hotplug from unmap_hotplug_* function names Mike Rapoport
2022-08-19 4:11 ` [PATCH 3/5] arm64/mmu: move helpers for hotplug page tables freeing close to callers Mike Rapoport
2022-08-19 4:11 ` [PATCH 4/5] arm64/mm: remap crash kernel with base pages even if rodata_full disabled Mike Rapoport
2022-08-19 4:11 ` Mike Rapoport [this message]
2022-08-25 7:35 ` [PATCH 0/5] " Baoquan He
2022-08-25 7:48 ` Mike Rapoport
2022-08-28 8:37 ` Baoquan He
2022-08-29 14:31 ` Mike Rapoport
2022-08-30 3:24 ` Baoquan He
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=20220819041156.873873-6-rppt@kernel.org \
--to=rppt@kernel.org \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=guanghuifeng@linux.alibaba.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mark.rutland@arm.com \
--cc=rppt@linux.ibm.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