kexec-tools/kexec-tools-ppc-check-flags.diff

75 lines
2.4 KiB
Diff

From: Chandru <chandru@in.ibm.com>
Subject: kdump: check flags field from drconf memory
References: bnc#438086
X-Git-Id: 802a8a5e396e06a514251c44454c982bff3c5073
On a powerpc machine when memory is dynamically removed/added from an lpar, the
corresponding flags field in the drconf memory reflects the same with the bits
unset/set accordingly. The kernel does a check on these flags while booting.
Following are the similar changes brought in to kexec-tools. This makes
kexec-tools to skip those memory regions that do not belong or are not
assigned to the current partition ( but are available to dynamically add them
back ). Without this patch (and with memory remove operation) copying vmcore
fails with error as
Copying data : [ 84 %] readmem: Can't read the dump
memory(/proc/vmcore). Bad address
read_pfn: Can't get the page data.
Signed-off-by : Chandru S <chandru@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Acked-by: Bernhard Walle <bwalle@suse.de>
---
kexec/arch/ppc64/crashdump-ppc64.c | 12 ++++++++++--
kexec/arch/ppc64/crashdump-ppc64.h | 3 +++
2 files changed, 13 insertions(+), 2 deletions(-)
--- a/kexec/arch/ppc64/crashdump-ppc64.c
+++ b/kexec/arch/ppc64/crashdump-ppc64.c
@@ -121,12 +121,13 @@ static void exclude_crash_region(uint64_
}
}
-static int get_dyn_reconf_crash_memory_ranges()
+static int get_dyn_reconf_crash_memory_ranges(void)
{
uint64_t start, end;
char fname[128], buf[32];
FILE *file;
int i, n;
+ uint32_t flags;
strcpy(fname, "/proc/device-tree/");
strcat(fname, "ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory");
@@ -150,10 +151,17 @@ static int get_dyn_reconf_crash_memory_r
return -1;
}
- start = ((uint64_t *)buf)[0];
+ start = ((uint64_t *)buf)[DRCONF_ADDR];
end = start + lmb_size;
if (start == 0 && end >= (BACKUP_SRC_END + 1))
start = BACKUP_SRC_END + 1;
+
+ flags = (*((uint32_t *)&buf[DRCONF_FLAGS]));
+ /* skip this block if the reserved bit is set in flags (0x80)
+ or if the block is not assigned to this partition (0x8) */
+ if ((flags & 0x80) || !(flags & 0x8))
+ continue;
+
exclude_crash_region(start, end);
}
fclose(file);
--- a/kexec/arch/ppc64/crashdump-ppc64.h
+++ b/kexec/arch/ppc64/crashdump-ppc64.h
@@ -31,4 +31,7 @@ extern unsigned int rtas_size;
uint64_t lmb_size;
unsigned int num_of_lmbs;
+#define DRCONF_ADDR 0
+#define DRCONF_FLAGS 20
+
#endif /* CRASHDUMP_PPC64_H */