]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
powerpc/fadump: avoid holes in boot memory area when fadump is registered
authorHari Bathini <hbathini@linux.vnet.ibm.com>
Thu, 1 Jun 2017 17:21:26 +0000 (22:51 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 28 Jun 2017 03:08:09 +0000 (13:08 +1000)
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 <hbathini@linux.vnet.ibm.com>
Reviewed-by: Mahesh J Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/fadump.h
arch/powerpc/kernel/fadump.c
arch/powerpc/platforms/pseries/hotplug-memory.c

index a3de219073af24b6646c80cf7cc6364e8b0d6818..ce88bbe1d809ea038db3c9dacbacea30fcad4f0e 100644 (file)
@@ -203,6 +203,7 @@ struct fad_crash_memory_ranges {
        unsigned long long      size;
 };
 
+extern int is_fadump_boot_memory_area(u64 addr, ulong size);
 extern int early_init_dt_scan_fw_dump(unsigned long node,
                const char *uname, int depth, void *data);
 extern int fadump_reserve_mem(void);
index 08e00448a355cfae3767a773ad574545b1c2c887..750bff3b4af3f2e57621ae03b5f8461016fe4f47 100644 (file)
@@ -113,6 +113,18 @@ int __init early_init_dt_scan_fw_dump(unsigned long node,
        return 1;
 }
 
+/*
+ * If fadump is registered, check if the memory provided
+ * falls within boot memory area.
+ */
+int is_fadump_boot_memory_area(u64 addr, ulong size)
+{
+       if (!fw_dump.dump_registered)
+               return 0;
+
+       return (addr + size) > RMA_START && addr <= fw_dump.boot_memory_size;
+}
+
 int is_fadump_active(void)
 {
        return fw_dump.dump_active;
index e104c71ea44ab5bf715fa5720c0a1ed47c6221c7..a186b8e8019a76aadd4dc2f701d0a848b2404a3b 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/machdep.h>
 #include <asm/prom.h>
 #include <asm/sparsemem.h>
+#include <asm/fadump.h>
 #include "pseries.h"
 
 static bool rtas_hp_event;
@@ -406,6 +407,12 @@ static bool lmb_is_removable(struct of_drconf_cell *lmb)
        scns_per_block = block_sz / MIN_MEMORY_BLOCK_SIZE;
        phys_addr = lmb->base_addr;
 
+#ifdef CONFIG_FA_DUMP
+       /* Don't hot-remove memory that falls in fadump boot memory area */
+       if (is_fadump_boot_memory_area(phys_addr, block_sz))
+               return false;
+#endif
+
        for (i = 0; i < scns_per_block; i++) {
                pfn = PFN_DOWN(phys_addr);
                if (!pfn_present(pfn))