fadump.c (0cce284537fb42d9c28b9b31038ffc9b464555f5) fadump.c (f2a5e8f0023eba847ad2adb145b2f631934bb12b)
1/*
2 * Firmware Assisted dump: A robust mechanism to get reliable kernel crash
3 * dump with assistance from firmware. This approach does not use kexec,
4 * instead firmware assists in booting the kdump kernel while preserving
5 * memory contents. The most of the code implementation has been adapted
6 * from phyp assisted dump implementation written by Linas Vepstas and
7 * Manish Ahuja
8 *

--- 392 unchanged lines hidden (view full) ---

401 fw_dump.dump_registered = 1;
402 break;
403 }
404}
405
406void crash_fadump(struct pt_regs *regs, const char *str)
407{
408 struct fadump_crash_info_header *fdh = NULL;
1/*
2 * Firmware Assisted dump: A robust mechanism to get reliable kernel crash
3 * dump with assistance from firmware. This approach does not use kexec,
4 * instead firmware assists in booting the kdump kernel while preserving
5 * memory contents. The most of the code implementation has been adapted
6 * from phyp assisted dump implementation written by Linas Vepstas and
7 * Manish Ahuja
8 *

--- 392 unchanged lines hidden (view full) ---

401 fw_dump.dump_registered = 1;
402 break;
403 }
404}
405
406void crash_fadump(struct pt_regs *regs, const char *str)
407{
408 struct fadump_crash_info_header *fdh = NULL;
409 int old_cpu, this_cpu;
409
410 if (!fw_dump.dump_registered || !fw_dump.fadumphdr_addr)
411 return;
412
410
411 if (!fw_dump.dump_registered || !fw_dump.fadumphdr_addr)
412 return;
413
414 /*
415 * old_cpu == -1 means this is the first CPU which has come here,
416 * go ahead and trigger fadump.
417 *
418 * old_cpu != -1 means some other CPU has already on it's way
419 * to trigger fadump, just keep looping here.
420 */
421 this_cpu = smp_processor_id();
422 old_cpu = cmpxchg(&crashing_cpu, -1, this_cpu);
423
424 if (old_cpu != -1) {
425 /*
426 * We can't loop here indefinitely. Wait as long as fadump
427 * is in force. If we race with fadump un-registration this
428 * loop will break and then we go down to normal panic path
429 * and reboot. If fadump is in force the first crashing
430 * cpu will definitely trigger fadump.
431 */
432 while (fw_dump.dump_registered)
433 cpu_relax();
434 return;
435 }
436
413 fdh = __va(fw_dump.fadumphdr_addr);
437 fdh = __va(fw_dump.fadumphdr_addr);
414 crashing_cpu = smp_processor_id();
415 fdh->crashing_cpu = crashing_cpu;
416 crash_save_vmcoreinfo();
417
418 if (regs)
419 fdh->regs = *regs;
420 else
421 ppc_save_regs(&fdh->regs);
422

--- 904 unchanged lines hidden ---
438 fdh->crashing_cpu = crashing_cpu;
439 crash_save_vmcoreinfo();
440
441 if (regs)
442 fdh->regs = *regs;
443 else
444 ppc_save_regs(&fdh->regs);
445

--- 904 unchanged lines hidden ---