[PATCH] powerpc/fadump: Fix the race in crash_fadump().
Mahesh J Salgaonkar
mahesh at linux.vnet.ibm.com
Mon Oct 10 17:30:12 AEDT 2016
From: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
There are chances that multiple CPUs can call crash_fadump() simultaneously
and would start duplicating same info to vmcoreinfo ELF note section. This
causes makedumpfile to fail during kdump capture. One example is,
triggering dumprestart from HMC which sends system reset to all the CPUs at
once.
makedumpfile --dump-dmesg /proc/vmcore
read_vmcoreinfo_basic_info: Invalid data in /tmp/vmcoreinfoyjgxlL: CRASHTIME=1475605971CRASHTIME=1475605971CRASHTIME=1475605971CRASHTIME=1475605971CRASHTIME=1475605971CRASHTIME=1475605971CRASHTIME=1475605971CRASHTIME=1475605971
makedumpfile Failed.
Running makedumpfile --dump-dmesg /proc/vmcore failed (1).
makedumpfile -d 31 -l /proc/vmcore
read_vmcoreinfo_basic_info: Invalid data in /tmp/vmcoreinfo1mmVdO: CRASHTIME=1475605971CRASHTIME=1475605971CRASHTIME=1475605971CRASHTIME=1475605971CRASHTIME=1475605971CRASHTIME=1475605971CRASHTIME=1475605971CRASHTIME=1475605971
makedumpfile Failed.
Running makedumpfile -d 31 -l /proc/vmcore failed (1).
Signed-off-by: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
---
arch/powerpc/kernel/fadump.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index b3a6633..2ed9d1c 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -402,8 +402,14 @@ void crash_fadump(struct pt_regs *regs, const char *str)
{
struct fadump_crash_info_header *fdh = NULL;
- if (!fw_dump.dump_registered || !fw_dump.fadumphdr_addr)
+ mutex_lock(&fadump_mutex);
+ if (!fw_dump.dump_registered || !fw_dump.fadumphdr_addr) {
+ mutex_unlock(&fadump_mutex);
return;
+ }
+
+ if (crashing_cpu != -1)
+ goto unlock_out;
fdh = __va(fw_dump.fadumphdr_addr);
crashing_cpu = smp_processor_id();
@@ -417,6 +423,9 @@ void crash_fadump(struct pt_regs *regs, const char *str)
fdh->online_mask = *cpu_online_mask;
+unlock_out:
+ mutex_unlock(&fadump_mutex);
+
/* Call ibm,os-term rtas call to trigger firmware assisted dump */
rtas_os_term((char *)str);
}
More information about the Linuxppc-dev
mailing list