[PATCH 1/2] powerpc/fadump: reserve memory at halfway mark

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE3449d

3 messages, 2 authors, 2017-03-10 · open the first message on its own page

[PATCH 1/2] powerpc/fadump: reserve memory at halfway mark

From: Hari Bathini <hidden>
Date: 2017-03-09 14:48:11

Currently, the area to preserve boot memory is reserved at the top of
RAM. This leaves fadump vulnerable to DLPAR memory remove operations.
As memory for fadump needs to be reserved early in the boot process,
fadump can't be registered after a DLPAR memory remove operation.
While this problem can't be eleminated completely, the impact can be
minimized by reserving memory at the halfway mark instead. With this
change, fadump can register successfully after a DLPAR memory remove
operation as long as the sum of the sizes of boot memory and memory
removed is less than half of the total available memory.

Signed-off-by: Hari Bathini <redacted>
---
 arch/powerpc/kernel/fadump.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 8ff0dd4..9c85c5a 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -319,9 +319,13 @@ int __init fadump_reserve_mem(void)
 		pr_debug("fadumphdr_addr = %p\n",
 				(void *) fw_dump.fadumphdr_addr);
 	} else {
-		/* Reserve the memory at the top of memory. */
+		/*
+		 * Reserve memory at the halfway mark to minimize
+		 * the impact of DLPAR memory remove operation.
+		 */
+		base = PAGE_ALIGN(memory_boundary/2);
 		size = get_fadump_area_size();
-		base = memory_boundary - size;
+		WARN_ON((base + size) > memory_boundary);
 		memblock_reserve(base, size);
 		printk(KERN_INFO "Reserved %ldMB of memory at %ldMB "
 				"for firmware-assisted dump\n",

[PATCH 2/2] powerpc/fadump: update fadump documentation

From: Hari Bathini <hidden>
Date: 2017-03-09 14:48:21

With the unnecessary restriction to reserve memory for fadump at the
top of RAM forgone, update the documentation accordingly.

Signed-off-by: Hari Bathini <redacted>
---
 Documentation/powerpc/firmware-assisted-dump.txt |   34 +++++++++++-----------
 1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/Documentation/powerpc/firmware-assisted-dump.txt b/Documentation/powerpc/firmware-assisted-dump.txt
index 3007bc9..19b1e3d 100644
--- a/Documentation/powerpc/firmware-assisted-dump.txt
+++ b/Documentation/powerpc/firmware-assisted-dump.txt
@@ -105,21 +105,21 @@ memory is held.
 
 If there is no waiting dump data, then only the memory required
 to hold CPU state, HPTE region, boot memory dump and elfcore
-header, is reserved at the top of memory (see Fig. 1). This area
-is *not* released: this region will be kept permanently reserved,
-so that it can act as a receptacle for a copy of the boot memory
-content in addition to CPU state and HPTE region, in the case a
-crash does occur.
+header, is usually reserved at an offset greater than boot memory
+size (see Fig. 1). This area is *not* released: this region will
+be kept permanently reserved, so that it can act as a receptacle
+for a copy of the boot memory content in addition to CPU state
+and HPTE region, in the case a crash does occur.
 
   o Memory Reservation during first kernel
 
-  Low memory                                        Top of memory
+  Low memory                                         Top of memory
   0      boot memory size                                       |
-  |           |                       |<--Reserved dump area -->|
-  V           V                       |   Permanent Reservation V
-  +-----------+----------/ /----------+---+----+-----------+----+
-  |           |                       |CPU|HPTE|  DUMP     |ELF |
-  +-----------+----------/ /----------+---+----+-----------+----+
+  |           |                |<--Reserved dump area -->|      |
+  V           V                |   Permanent Reservation |      V
+  +-----------+----------/ /---+---+----+-----------+----+------+
+  |           |                |CPU|HPTE|  DUMP     |ELF |      |
+  +-----------+----------/ /---+---+----+-----------+----+------+
         |                                           ^
         |                                           |
         \                                           /
@@ -135,12 +135,12 @@ crash does occur.
   0      boot memory size                                       |
   |           |<------------- Reserved dump area ----------- -->|
   V           V                                                 V
-  +-----------+----------/ /----------+---+----+-----------+----+
-  |           |                       |CPU|HPTE|  DUMP     |ELF |
-  +-----------+----------/ /----------+---+----+-----------+----+
-        |                                                    |
-        V                                                    V
-   Used by second                                    /proc/vmcore
+  +-----------+----------/ /---+---+----+-----------+----+------+
+  |           |                |CPU|HPTE|  DUMP     |ELF |      |
+  +-----------+----------/ /---+---+----+-----------+----+------+
+        |                                              |
+        V                                              V
+   Used by second                                /proc/vmcore
    kernel to boot
                    Fig. 2
 

Re: [PATCH 1/2] powerpc/fadump: reserve memory at halfway mark

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2017-03-10 10:44:37

Hari Bathini [off-list ref] writes:
quoted hunk
Currently, the area to preserve boot memory is reserved at the top of
RAM. This leaves fadump vulnerable to DLPAR memory remove operations.
As memory for fadump needs to be reserved early in the boot process,
fadump can't be registered after a DLPAR memory remove operation.
While this problem can't be eleminated completely, the impact can be
minimized by reserving memory at the halfway mark instead. With this
change, fadump can register successfully after a DLPAR memory remove
operation as long as the sum of the sizes of boot memory and memory
removed is less than half of the total available memory.

Signed-off-by: Hari Bathini <redacted>
---
 arch/powerpc/kernel/fadump.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 8ff0dd4..9c85c5a 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -319,9 +319,13 @@ int __init fadump_reserve_mem(void)
 		pr_debug("fadumphdr_addr = %p\n",
 				(void *) fw_dump.fadumphdr_addr);
 	} else {
-		/* Reserve the memory at the top of memory. */
+		/*
+		 * Reserve memory at the halfway mark to minimize
+		 * the impact of DLPAR memory remove operation.
+		 */
+		base = PAGE_ALIGN(memory_boundary/2);
This doesn't account for holes, do we never have holes in the memory
layout on phyp?

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help