From: Hari Bathini <hidden> Date: 2017-05-04 17:54:41
fadump sets up crash memory ranges to be used for creating PT_LOAD
program headers in elfcore header. Memory chunk RMA_START through
boot memory area size is added as the first memory range because
firmware, at the time of crash, moves this memory chunk to different
location specified during fadump registration making it necessary to
create a separate program header for it with the correct offset.
This memory chunk is skipped while setting up the remaining memory
ranges. But currently, there is possibility that some of this memory
may have duplicate entries like when it is hot-removed and added
again. Ensure that no two memory ranges represent the same memory.
When 5 lmbs are hot-removed and then hot-plugged before registering
fadump, here is how the program headers in /proc/vmcore exported by
fadump look like
without this change:
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
NOTE 0x0000000000010000 0x0000000000000000 0x0000000000000000
0x0000000000001894 0x0000000000001894 0
LOAD 0x0000000000021020 0xc000000000000000 0x0000000000000000
0x0000000040000000 0x0000000040000000 RWE 0
LOAD 0x0000000040031020 0xc000000000000000 0x0000000000000000
0x0000000010000000 0x0000000010000000 RWE 0
LOAD 0x0000000050040000 0xc000000010000000 0x0000000010000000
0x0000000050000000 0x0000000050000000 RWE 0
LOAD 0x00000000a0040000 0xc000000060000000 0x0000000060000000
0x000000019ffe0000 0x000000019ffe0000 RWE 0
and with this change:
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
NOTE 0x0000000000010000 0x0000000000000000 0x0000000000000000
0x0000000000001894 0x0000000000001894 0
LOAD 0x0000000000021020 0xc000000000000000 0x0000000000000000
0x0000000040000000 0x0000000040000000 RWE 0
LOAD 0x0000000040030000 0xc000000040000000 0x0000000040000000
0x0000000020000000 0x0000000020000000 RWE 0
LOAD 0x0000000060030000 0xc000000060000000 0x0000000060000000
0x000000019ffe0000 0x000000019ffe0000 RWE 0
Signed-off-by: Hari Bathini <redacted>
---
arch/powerpc/kernel/fadump.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
From: Hari Bathini <hidden> Date: 2017-05-04 17:55:12
To register fadump, boot memory area - the size of low memory chunk that
is required for a kernel to boot successfully when booted with restricted
memory, is assumed to have no holes. But this memory area is currently
not protected from hot-remove operations. So, fadump could fail to
re-register after a memory hot-remove operation, if memory is removed
from boot memory area. To avoid this, ensure that memory from boot
memory area is not hot-removed when fadump is registered.
Signed-off-by: Hari Bathini <redacted>
---
arch/powerpc/include/asm/fadump.h | 1 +
arch/powerpc/kernel/fadump.c | 12 ++++++++++++
arch/powerpc/platforms/pseries/hotplug-memory.c | 7 +++++++
3 files changed, 20 insertions(+)
@@ -114,6 +114,18 @@ int __init early_init_dt_scan_fw_dump(unsigned long node,return1;}+/*+*Iffadumpisregistered,checkifthememoryprovided+*fallswithinbootmemoryarea.+*/+intis_fadump_boot_memory_area(u64addr,ulongsize)+{+if(!fw_dump.dump_registered)+return0;++return(addr+size)>RMA_START&&addr<=fw_dump.boot_memory_size;+}+intis_fadump_active(void){returnfw_dump.dump_active;
To register fadump, boot memory area - the size of low memory chunk that
is required for a kernel to boot successfully when booted with restricted
memory, is assumed to have no holes. But this memory area is currently
not protected from hot-remove operations. So, fadump could fail to
re-register after a memory hot-remove operation, if memory is removed
from boot memory area. To avoid this, ensure that memory from boot
memory area is not hot-removed when fadump is registered.
Signed-off-by: Hari Bathini <redacted>
@@ -114,6 +114,18 @@ int __init early_init_dt_scan_fw_dump(unsigned long node,return1;}+/*+*Iffadumpisregistered,checkifthememoryprovided+*fallswithinbootmemoryarea.+*/+intis_fadump_boot_memory_area(u64addr,ulongsize)+{+if(!fw_dump.dump_registered)+return0;++return(addr+size)>RMA_START&&addr<=fw_dump.boot_memory_size;+}+intis_fadump_active(void){returnfw_dump.dump_active;
From: Pingfan Liu <hidden> Date: 2017-05-05 11:43:21
----- Original Message -----
From: "Hari Bathini" <redacted>
To: "Michael Ellerman" <mpe@ellerman.id.au>
Cc: "linuxppc-dev" <redacted>, "Pingfan Liu" <redacted>, "Mahesh J Salgaonkar"
[off-list ref]
Sent: Friday, May 5, 2017 1:54:05 AM
Subject: [PATCH 2/2] powerpc/fadump: avoid holes in boot memory area when fadump is registered
To register fadump, boot memory area - the size of low memory chunk that
is required for a kernel to boot successfully when booted with restricted
memory, is assumed to have no holes. But this memory area is currently
The continuous is required by fadump code, not by the firmware itself, right?
Thanks and regards,
Pingfan
quoted hunk
not protected from hot-remove operations. So, fadump could fail to
re-register after a memory hot-remove operation, if memory is removed
from boot memory area. To avoid this, ensure that memory from boot
memory area is not hot-removed when fadump is registered.
Signed-off-by: Hari Bathini <redacted>
---
arch/powerpc/include/asm/fadump.h | 1 +
arch/powerpc/kernel/fadump.c | 12 ++++++++++++
arch/powerpc/platforms/pseries/hotplug-memory.c | 7 +++++++
3 files changed, 20 insertions(+)
diff --git a/arch/powerpc/include/asm/fadump.h
b/arch/powerpc/include/asm/fadump.h
index 0031806..609fccc 100644
From: Hari Bathini <hidden> Date: 2017-05-05 14:32:48
On Friday 05 May 2017 05:13 PM, Pingfan Liu wrote:
----- Original Message -----
quoted
From: "Hari Bathini" <redacted>
To: "Michael Ellerman" <mpe@ellerman.id.au>
Cc: "linuxppc-dev" <redacted>, "Pingfan Liu" <redacted>, "Mahesh J Salgaonkar"
[off-list ref]
Sent: Friday, May 5, 2017 1:54:05 AM
Subject: [PATCH 2/2] powerpc/fadump: avoid holes in boot memory area when fadump is registered
To register fadump, boot memory area - the size of low memory chunk that
is required for a kernel to boot successfully when booted with restricted
memory, is assumed to have no holes. But this memory area is currently
The continuous is required by fadump code, not by the firmware itself, right?
Hmmm... Firmware takes a memory region,what we are calling boot memory
area, as input to be backed up at the time of crash. The same memory
region is used by kernel to boot after the crash. Firmware doesn't allow
holes in this memory region at the time of registering...
Thanks
Hari
fadump sets up crash memory ranges to be used for creating PT_LOAD
program headers in elfcore header. Memory chunk RMA_START through
boot memory area size is added as the first memory range because
firmware, at the time of crash, moves this memory chunk to different
location specified during fadump registration making it necessary to
create a separate program header for it with the correct offset.
This memory chunk is skipped while setting up the remaining memory
ranges. But currently, there is possibility that some of this memory
may have duplicate entries like when it is hot-removed and added
again. Ensure that no two memory ranges represent the same memory.
When 5 lmbs are hot-removed and then hot-plugged before registering
fadump, here is how the program headers in /proc/vmcore exported by
fadump look like
We should also make sure that fadump registration fails with proper
error if user don't put back those lmbs creating holes below the boot
memory size.
But for this patch
Reviewed-by: Mahesh J Salgaonkar <redacted>
Thanks,
-Mahesh.