Skip to content

Commit 504cae4

Browse files
Baoquan Hewilldeacon
authored andcommitted
arm64: kdump: defer the crashkernel reservation for platforms with no DMA memory zones
In commit 0314956 ("arm64: Do not defer reserve_crashkernel() for platforms with no DMA memory zones"), reserve_crashkernel() is called much earlier in arm64_memblock_init() to avoid causing base apge mapping on platforms with no DMA meomry zones. With taking off protection on crashkernel memory region, no need to call reserve_crashkernel() specially in advance. The deferred invocation of reserve_crashkernel() in bootmem_init() can cover all cases. So revert the whole commit now. Signed-off-by: Baoquan He <[email protected]> Reviewed-by: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 04a2a7a commit 504cae4

File tree

2 files changed

+3
-36
lines changed

2 files changed

+3
-36
lines changed

arch/arm64/include/asm/memory.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,6 @@ static inline void *phys_to_virt(phys_addr_t x)
374374
})
375375

376376
void dump_mem_limit(void);
377-
378-
static inline bool defer_reserve_crashkernel(void)
379-
{
380-
return IS_ENABLED(CONFIG_ZONE_DMA) || IS_ENABLED(CONFIG_ZONE_DMA32);
381-
}
382377
#endif /* !ASSEMBLY */
383378

384379
/*

arch/arm64/mm/init.c

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -61,34 +61,8 @@ EXPORT_SYMBOL(memstart_addr);
6161
* unless restricted on specific platforms (e.g. 30-bit on Raspberry Pi 4).
6262
* In such case, ZONE_DMA32 covers the rest of the 32-bit addressable memory,
6363
* otherwise it is empty.
64-
*
65-
* Memory reservation for crash kernel either done early or deferred
66-
* depending on DMA memory zones configs (ZONE_DMA) --
67-
*
68-
* In absence of ZONE_DMA configs arm64_dma_phys_limit initialized
69-
* here instead of max_zone_phys(). This lets early reservation of
70-
* crash kernel memory which has a dependency on arm64_dma_phys_limit.
71-
* Reserving memory early for crash kernel allows linear creation of block
72-
* mappings (greater than page-granularity) for all the memory bank rangs.
73-
* In this scheme a comparatively quicker boot is observed.
74-
*
75-
* If ZONE_DMA configs are defined, crash kernel memory reservation
76-
* is delayed until DMA zone memory range size initialization performed in
77-
* zone_sizes_init(). The defer is necessary to steer clear of DMA zone
78-
* memory range to avoid overlap allocation. So crash kernel memory boundaries
79-
* are not known when mapping all bank memory ranges, which otherwise means
80-
* not possible to exclude crash kernel range from creating block mappings
81-
* so page-granularity mappings are created for the entire memory range.
82-
* Hence a slightly slower boot is observed.
83-
*
84-
* Note: Page-granularity mappings are necessary for crash kernel memory
85-
* range for shrinking its size via /sys/kernel/kexec_crash_size interface.
8664
*/
87-
#if IS_ENABLED(CONFIG_ZONE_DMA) || IS_ENABLED(CONFIG_ZONE_DMA32)
8865
phys_addr_t __ro_after_init arm64_dma_phys_limit;
89-
#else
90-
phys_addr_t __ro_after_init arm64_dma_phys_limit = PHYS_MASK + 1;
91-
#endif
9266

9367
/* Current arm64 boot protocol requires 2MB alignment */
9468
#define CRASH_ALIGN SZ_2M
@@ -248,6 +222,8 @@ static void __init zone_sizes_init(void)
248222
if (!arm64_dma_phys_limit)
249223
arm64_dma_phys_limit = dma32_phys_limit;
250224
#endif
225+
if (!arm64_dma_phys_limit)
226+
arm64_dma_phys_limit = PHYS_MASK + 1;
251227
max_zone_pfns[ZONE_NORMAL] = max_pfn;
252228

253229
free_area_init(max_zone_pfns);
@@ -408,9 +384,6 @@ void __init arm64_memblock_init(void)
408384

409385
early_init_fdt_scan_reserved_mem();
410386

411-
if (!defer_reserve_crashkernel())
412-
reserve_crashkernel();
413-
414387
high_memory = __va(memblock_end_of_DRAM() - 1) + 1;
415388
}
416389

@@ -457,8 +430,7 @@ void __init bootmem_init(void)
457430
* request_standard_resources() depends on crashkernel's memory being
458431
* reserved, so do it here.
459432
*/
460-
if (defer_reserve_crashkernel())
461-
reserve_crashkernel();
433+
reserve_crashkernel();
462434

463435
memblock_dump_all();
464436
}

0 commit comments

Comments
 (0)