Skip to content

Commit

Permalink
Revert "powerpc: Do not call ppc_md.panic in fadump panic notifier"
Browse files Browse the repository at this point in the history
This reverts commit a3b2cb3.

That commit tried to fix problems with panic on powerpc in certain
circumstances, where some output from the generic panic code was being
dropped.

Unfortunately, it breaks things worse in other circumstances. In
particular when running a PAPR guest, it will now attempt to reboot
instead of informing the hypervisor (KVM or PowerVM) that the guest
has crashed. The crash notification is important to some
virtualization management layers.

Revert it for now until we can come up with a better solution.

Fixes: a3b2cb3 ("powerpc: Do not call ppc_md.panic in fadump panic notifier")
Cc: [email protected] # v4.14+
Signed-off-by: David Gibson <[email protected]>
[mpe: Tweak change log a bit]
Signed-off-by: Michael Ellerman <[email protected]>
  • Loading branch information
dgibson authored and mpe committed Dec 5, 2017
1 parent 5aa04b3 commit ab9dbf7
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 22 deletions.
1 change: 1 addition & 0 deletions arch/powerpc/include/asm/machdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct machdep_calls {

void __noreturn (*restart)(char *cmd);
void __noreturn (*halt)(void);
void (*panic)(char *str);
void (*cpu_die)(void);

long (*time_init)(void); /* Optional, may be NULL */
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/include/asm/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extern void reloc_got2(unsigned long);

void check_for_initrd(void);
void initmem_init(void);
void setup_panic(void);
#define ARCH_PANIC_TIMEOUT 180

#ifdef CONFIG_PPC_PSERIES
Expand Down
22 changes: 0 additions & 22 deletions arch/powerpc/kernel/fadump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1462,25 +1462,6 @@ static void fadump_init_files(void)
return;
}

static int fadump_panic_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
/*
* If firmware-assisted dump has been registered then trigger
* firmware-assisted dump and let firmware handle everything
* else. If this returns, then fadump was not registered, so
* go through the rest of the panic path.
*/
crash_fadump(NULL, ptr);

return NOTIFY_DONE;
}

static struct notifier_block fadump_panic_block = {
.notifier_call = fadump_panic_event,
.priority = INT_MIN /* may not return; must be done last */
};

/*
* Prepare for firmware-assisted dump.
*/
Expand Down Expand Up @@ -1513,9 +1494,6 @@ int __init setup_fadump(void)
init_fadump_mem_struct(&fdm, fw_dump.reserve_dump_area_start);
fadump_init_files();

atomic_notifier_chain_register(&panic_notifier_list,
&fadump_panic_block);

return 1;
}
subsys_initcall(setup_fadump);
27 changes: 27 additions & 0 deletions arch/powerpc/kernel/setup-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,30 @@ int check_legacy_ioport(unsigned long base_port)
}
EXPORT_SYMBOL(check_legacy_ioport);

static int ppc_panic_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
/*
* If firmware-assisted dump has been registered then trigger
* firmware-assisted dump and let firmware handle everything else.
*/
crash_fadump(NULL, ptr);
ppc_md.panic(ptr); /* May not return */
return NOTIFY_DONE;
}

static struct notifier_block ppc_panic_block = {
.notifier_call = ppc_panic_event,
.priority = INT_MIN /* may not return; must be done last */
};

void __init setup_panic(void)
{
if (!ppc_md.panic)
return;
atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block);
}

#ifdef CONFIG_CHECK_CACHE_COHERENCY
/*
* For platforms that have configurable cache-coherency. This function
Expand Down Expand Up @@ -848,6 +872,9 @@ void __init setup_arch(char **cmdline_p)
/* Probe the machine type, establish ppc_md. */
probe_machine();

/* Setup panic notifier if requested by the platform. */
setup_panic();

/*
* Configure ppc_md.power_save (ppc32 only, 64-bit machines do
* it from their respective probe() function.
Expand Down
15 changes: 15 additions & 0 deletions arch/powerpc/platforms/ps3/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,20 @@ static void __noreturn ps3_halt(void)
ps3_sys_manager_halt(); /* never returns */
}

static void ps3_panic(char *str)
{
DBG("%s:%d %s\n", __func__, __LINE__, str);

smp_send_stop();
printk("\n");
printk(" System does not reboot automatically.\n");
printk(" Please press POWER button.\n");
printk("\n");

while(1)
lv1_pause(1);
}

#if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \
defined(CONFIG_PS3_FLASH) || defined(CONFIG_PS3_FLASH_MODULE)
static void __init prealloc(struct ps3_prealloc *p)
Expand Down Expand Up @@ -255,6 +269,7 @@ define_machine(ps3) {
.probe = ps3_probe,
.setup_arch = ps3_setup_arch,
.init_IRQ = ps3_init_IRQ,
.panic = ps3_panic,
.get_boot_time = ps3_get_boot_time,
.set_dabr = ps3_set_dabr,
.calibrate_decr = ps3_calibrate_decr,
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/platforms/pseries/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,7 @@ define_machine(pseries) {
.pcibios_fixup = pSeries_final_fixup,
.restart = rtas_restart,
.halt = rtas_halt,
.panic = rtas_os_term,
.get_boot_time = rtas_get_boot_time,
.get_rtc_time = rtas_get_rtc_time,
.set_rtc_time = rtas_set_rtc_time,
Expand Down

0 comments on commit ab9dbf7

Please sign in to comment.