Skip to contentSkip to conversation

powerpc/crashkernel: take mem option into account

PATCH In review Pingfan Liu 1 participant 3 messages Sep 9, 2019 – Sep 12, 2019 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/crashkernel: take mem option into account

'mem=" option is an easy way to put high pressure on memory during some test. Hence in stead of total mem, the effective usable memory size should be considered when reserving mem for crashkernel. Otherwise the boot up may experience oom issue.

E.g passing crashkernel="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G", and mem=5G.

Cc Hari Bathini <[email protected]>
Cc Michael Ellerman <[email protected]>

To: [email protected]

---
 arch/powerpc/kernel/machine_kexec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/kernel/machine_kexec.c +3 -2
index c4ed328..714b733 100644
@@ -114,11 +114,12 @@ void machine_kexec(struct kimage *image)
 
 void __init reserve_crashkernel(void)
 {
-	unsigned long long crash_size, crash_base;
+	unsigned long long crash_size, crash_base, total_mem_sz;
 	int ret;
 
+	total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size();
 	/* use common parsing */
-	ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
+	ret = parse_crashkernel(boot_command_line, total_mem_sz,
 			&crash_size, &crash_base);
 	if (ret == 0 && crash_size > 0) {
 		crashk_res.start = crash_base;
Signature · 1 line
2.7.5
#1 lore raw
Quoted 23 lines · Pingfan Liu

'mem=" option is an easy way to put high pressure on memory during some test. Hence in stead of total mem, the effective usable memory size should be considered when reserving mem for crashkernel. Otherwise the boot up may experience oom issue.

E.g passing crashkernel="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G", and mem=5G.

Cc Hari Bathini <[email protected]>
Cc Michael Ellerman <[email protected]>

To: [email protected]

---
 arch/powerpc/kernel/machine_kexec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/kernel/machine_kexec.c +0 -0
index c4ed328..714b733 100644

arch/powerpc/kernel/machine_kexec.c void machine_kexec(struct kimage *image) · line 120

Quoted 8 lines
arch/powerpc/kernel/machine_kexec.c +2 -1
@@ -114,11 +114,12 @@ void machine_kexec(struct kimage *image)
 
 void __init reserve_crashkernel(void)
 {
-       unsigned long long crash_size, crash_base;
+       unsigned long long crash_size, crash_base, total_mem_sz;
        int ret;
 
+       total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size();

Here memory_limit is used to esstimation and may be changed. So I think it is better to use memory_limit here than moving memblock_enforce_memory_limit() before the call to reserve_crashkernel()

Thanks,
Pingfan

Quoted 9 lines
arch/powerpc/kernel/machine_kexec.c +1 -2
        /* use common parsing */
-       ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
+       ret = parse_crashkernel(boot_command_line, total_mem_sz,
                        &crash_size, &crash_base);
        if (ret == 0 && crash_size > 0) {
                crashk_res.start = crash_base;
--

2.7.5

#2 lore raw
In reply to Pingfan Liu

NACK it. Due to a miss the updating of printk info. I will send out V2

Quoted 40 lines · Pingfan Liu

'mem=" option is an easy way to put high pressure on memory during some test. Hence in stead of total mem, the effective usable memory size should be considered when reserving mem for crashkernel. Otherwise the boot up may experience oom issue.

E.g passing crashkernel="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G", and mem=5G.

Cc Hari Bathini <[email protected]>
Cc Michael Ellerman <[email protected]>

To: [email protected]

---
 arch/powerpc/kernel/machine_kexec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/kernel/machine_kexec.c +3 -3
index c4ed328..714b733 100644
@@ -114,11 +114,12 @@ void machine_kexec(struct kimage *image)
 
 void __init reserve_crashkernel(void)
 {
-       unsigned long long crash_size, crash_base;
+       unsigned long long crash_size, crash_base, total_mem_sz;
        int ret;
 
+       total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size();
        /* use common parsing */
-       ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
+       ret = parse_crashkernel(boot_command_line, total_mem_sz,
                        &crash_size, &crash_base);
        if (ret == 0 && crash_size > 0) {
                crashk_res.start = crash_base;
--

2.7.5