Skip to content

Commit 7c5ed82

Browse files
sourabhjainsmpe
authored andcommitted
powerpc: Set crashkernel offset to mid of RMA region
On large config LPARs (having 192 and more cores), Linux fails to boot due to insufficient memory in the first memblock. It is due to the memory reservation for the crash kernel which starts at 128MB offset of the first memblock. This memory reservation for the crash kernel doesn't leave enough space in the first memblock to accommodate other essential system resources. The crash kernel start address was set to 128MB offset by default to ensure that the crash kernel get some memory below the RMA region which is used to be of size 256MB. But given that the RMA region size can be 512MB or more, setting the crash kernel offset to mid of RMA size will leave enough space for the kernel to allocate memory for other system resources. Since the above crash kernel offset change is only applicable to the LPAR platform, the LPAR feature detection is pushed before the crash kernel reservation. The rest of LPAR specific initialization will still be done during pseries_probe_fw_features as usual. This patch is dependent on changes to paca allocation for boot CPU. It expect boot CPU to discover 1T segment support which is introduced by the patch posted here: https://lists.ozlabs.org/pipermail/linuxppc-dev/2022-January/239175.html Reported-by: Abdul haleem <[email protected]> Signed-off-by: Sourabh Jain <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 4291d08 commit 7c5ed82

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

arch/powerpc/kernel/rtas.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,12 @@ int __init early_init_dt_scan_rtas(unsigned long node,
13131313
entryp = of_get_flat_dt_prop(node, "linux,rtas-entry", NULL);
13141314
sizep = of_get_flat_dt_prop(node, "rtas-size", NULL);
13151315

1316+
#ifdef CONFIG_PPC64
1317+
/* need this feature to decide the crashkernel offset */
1318+
if (of_get_flat_dt_prop(node, "ibm,hypertas-functions", NULL))
1319+
powerpc_firmware_features |= FW_FEATURE_LPAR;
1320+
#endif
1321+
13161322
if (basep && entryp && sizep) {
13171323
rtas.base = *basep;
13181324
rtas.entry = *entryp;

arch/powerpc/kexec/core.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,18 @@ void __init reserve_crashkernel(void)
134134
if (!crashk_res.start) {
135135
#ifdef CONFIG_PPC64
136136
/*
137-
* On 64bit we split the RMO in half but cap it at half of
138-
* a small SLB (128MB) since the crash kernel needs to place
139-
* itself and some stacks to be in the first segment.
137+
* On the LPAR platform place the crash kernel to mid of
138+
* RMA size (512MB or more) to ensure the crash kernel
139+
* gets enough space to place itself and some stack to be
140+
* in the first segment. At the same time normal kernel
141+
* also get enough space to allocate memory for essential
142+
* system resource in the first segment. Keep the crash
143+
* kernel starts at 128MB offset on other platforms.
140144
*/
141-
crashk_res.start = min(0x8000000ULL, (ppc64_rma_size / 2));
145+
if (firmware_has_feature(FW_FEATURE_LPAR))
146+
crashk_res.start = ppc64_rma_size / 2;
147+
else
148+
crashk_res.start = min(0x8000000ULL, (ppc64_rma_size / 2));
142149
#else
143150
crashk_res.start = KDUMP_KERNELBASE;
144151
#endif

0 commit comments

Comments
 (0)