Skip to content

Commit ab9dbf7

Browse files
dgibsonmpe
authored andcommitted
Revert "powerpc: Do not call ppc_md.panic in fadump panic notifier"
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]>
1 parent 5aa04b3 commit ab9dbf7

File tree

6 files changed

+45
-22
lines changed

6 files changed

+45
-22
lines changed

arch/powerpc/include/asm/machdep.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ struct machdep_calls {
7676

7777
void __noreturn (*restart)(char *cmd);
7878
void __noreturn (*halt)(void);
79+
void (*panic)(char *str);
7980
void (*cpu_die)(void);
8081

8182
long (*time_init)(void); /* Optional, may be NULL */

arch/powerpc/include/asm/setup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ extern void reloc_got2(unsigned long);
2424

2525
void check_for_initrd(void);
2626
void initmem_init(void);
27+
void setup_panic(void);
2728
#define ARCH_PANIC_TIMEOUT 180
2829

2930
#ifdef CONFIG_PPC_PSERIES

arch/powerpc/kernel/fadump.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,25 +1462,6 @@ static void fadump_init_files(void)
14621462
return;
14631463
}
14641464

1465-
static int fadump_panic_event(struct notifier_block *this,
1466-
unsigned long event, void *ptr)
1467-
{
1468-
/*
1469-
* If firmware-assisted dump has been registered then trigger
1470-
* firmware-assisted dump and let firmware handle everything
1471-
* else. If this returns, then fadump was not registered, so
1472-
* go through the rest of the panic path.
1473-
*/
1474-
crash_fadump(NULL, ptr);
1475-
1476-
return NOTIFY_DONE;
1477-
}
1478-
1479-
static struct notifier_block fadump_panic_block = {
1480-
.notifier_call = fadump_panic_event,
1481-
.priority = INT_MIN /* may not return; must be done last */
1482-
};
1483-
14841465
/*
14851466
* Prepare for firmware-assisted dump.
14861467
*/
@@ -1513,9 +1494,6 @@ int __init setup_fadump(void)
15131494
init_fadump_mem_struct(&fdm, fw_dump.reserve_dump_area_start);
15141495
fadump_init_files();
15151496

1516-
atomic_notifier_chain_register(&panic_notifier_list,
1517-
&fadump_panic_block);
1518-
15191497
return 1;
15201498
}
15211499
subsys_initcall(setup_fadump);

arch/powerpc/kernel/setup-common.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,30 @@ int check_legacy_ioport(unsigned long base_port)
704704
}
705705
EXPORT_SYMBOL(check_legacy_ioport);
706706

707+
static int ppc_panic_event(struct notifier_block *this,
708+
unsigned long event, void *ptr)
709+
{
710+
/*
711+
* If firmware-assisted dump has been registered then trigger
712+
* firmware-assisted dump and let firmware handle everything else.
713+
*/
714+
crash_fadump(NULL, ptr);
715+
ppc_md.panic(ptr); /* May not return */
716+
return NOTIFY_DONE;
717+
}
718+
719+
static struct notifier_block ppc_panic_block = {
720+
.notifier_call = ppc_panic_event,
721+
.priority = INT_MIN /* may not return; must be done last */
722+
};
723+
724+
void __init setup_panic(void)
725+
{
726+
if (!ppc_md.panic)
727+
return;
728+
atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block);
729+
}
730+
707731
#ifdef CONFIG_CHECK_CACHE_COHERENCY
708732
/*
709733
* For platforms that have configurable cache-coherency. This function
@@ -848,6 +872,9 @@ void __init setup_arch(char **cmdline_p)
848872
/* Probe the machine type, establish ppc_md. */
849873
probe_machine();
850874

875+
/* Setup panic notifier if requested by the platform. */
876+
setup_panic();
877+
851878
/*
852879
* Configure ppc_md.power_save (ppc32 only, 64-bit machines do
853880
* it from their respective probe() function.

arch/powerpc/platforms/ps3/setup.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,20 @@ static void __noreturn ps3_halt(void)
104104
ps3_sys_manager_halt(); /* never returns */
105105
}
106106

107+
static void ps3_panic(char *str)
108+
{
109+
DBG("%s:%d %s\n", __func__, __LINE__, str);
110+
111+
smp_send_stop();
112+
printk("\n");
113+
printk(" System does not reboot automatically.\n");
114+
printk(" Please press POWER button.\n");
115+
printk("\n");
116+
117+
while(1)
118+
lv1_pause(1);
119+
}
120+
107121
#if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \
108122
defined(CONFIG_PS3_FLASH) || defined(CONFIG_PS3_FLASH_MODULE)
109123
static void __init prealloc(struct ps3_prealloc *p)
@@ -255,6 +269,7 @@ define_machine(ps3) {
255269
.probe = ps3_probe,
256270
.setup_arch = ps3_setup_arch,
257271
.init_IRQ = ps3_init_IRQ,
272+
.panic = ps3_panic,
258273
.get_boot_time = ps3_get_boot_time,
259274
.set_dabr = ps3_set_dabr,
260275
.calibrate_decr = ps3_calibrate_decr,

arch/powerpc/platforms/pseries/setup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ define_machine(pseries) {
726726
.pcibios_fixup = pSeries_final_fixup,
727727
.restart = rtas_restart,
728728
.halt = rtas_halt,
729+
.panic = rtas_os_term,
729730
.get_boot_time = rtas_get_boot_time,
730731
.get_rtc_time = rtas_get_rtc_time,
731732
.set_rtc_time = rtas_set_rtc_time,

0 commit comments

Comments
 (0)