aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2017-12-04 00:27:25 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2017-12-05 07:21:46 -0500
commitab9dbf771ff9b6b7e814e759213ed01d7f0de320 (patch)
tree341a012d6b6d82c2f825d617b4ecd91f3911398d
parent5aa04b3eb6fca63d2e9827be656dcadc26d54e11 (diff)
Revert "powerpc: Do not call ppc_md.panic in fadump panic notifier"
This reverts commit a3b2cb30f252b21a6f962e0dd107c8b897ca65e4. 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: a3b2cb30f252 ("powerpc: Do not call ppc_md.panic in fadump panic notifier") Cc: stable@vger.kernel.org # v4.14+ Signed-off-by: David Gibson <david@gibson.dropbear.id.au> [mpe: Tweak change log a bit] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/include/asm/machdep.h1
-rw-r--r--arch/powerpc/include/asm/setup.h1
-rw-r--r--arch/powerpc/kernel/fadump.c22
-rw-r--r--arch/powerpc/kernel/setup-common.c27
-rw-r--r--arch/powerpc/platforms/ps3/setup.c15
-rw-r--r--arch/powerpc/platforms/pseries/setup.c1
6 files changed, 45 insertions, 22 deletions
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 73b92017b6d7..cd2fc1cc1cc7 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -76,6 +76,7 @@ struct machdep_calls {
76 76
77 void __noreturn (*restart)(char *cmd); 77 void __noreturn (*restart)(char *cmd);
78 void __noreturn (*halt)(void); 78 void __noreturn (*halt)(void);
79 void (*panic)(char *str);
79 void (*cpu_die)(void); 80 void (*cpu_die)(void);
80 81
81 long (*time_init)(void); /* Optional, may be NULL */ 82 long (*time_init)(void); /* Optional, may be NULL */
diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h
index 257d23dbf55d..cf00ec26303a 100644
--- a/arch/powerpc/include/asm/setup.h
+++ b/arch/powerpc/include/asm/setup.h
@@ -24,6 +24,7 @@ extern void reloc_got2(unsigned long);
24 24
25void check_for_initrd(void); 25void check_for_initrd(void);
26void initmem_init(void); 26void initmem_init(void);
27void setup_panic(void);
27#define ARCH_PANIC_TIMEOUT 180 28#define ARCH_PANIC_TIMEOUT 180
28 29
29#ifdef CONFIG_PPC_PSERIES 30#ifdef CONFIG_PPC_PSERIES
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 04ea5c04fd24..3c2c2688918f 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -1462,25 +1462,6 @@ static void fadump_init_files(void)
1462 return; 1462 return;
1463} 1463}
1464 1464
1465static 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
1479static 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
1484/* 1465/*
1485 * Prepare for firmware-assisted dump. 1466 * Prepare for firmware-assisted dump.
1486 */ 1467 */
@@ -1513,9 +1494,6 @@ int __init setup_fadump(void)
1513 init_fadump_mem_struct(&fdm, fw_dump.reserve_dump_area_start); 1494 init_fadump_mem_struct(&fdm, fw_dump.reserve_dump_area_start);
1514 fadump_init_files(); 1495 fadump_init_files();
1515 1496
1516 atomic_notifier_chain_register(&panic_notifier_list,
1517 &fadump_panic_block);
1518
1519 return 1; 1497 return 1;
1520} 1498}
1521subsys_initcall(setup_fadump); 1499subsys_initcall(setup_fadump);
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 2075322cd225..9d213542a48b 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -704,6 +704,30 @@ int check_legacy_ioport(unsigned long base_port)
704} 704}
705EXPORT_SYMBOL(check_legacy_ioport); 705EXPORT_SYMBOL(check_legacy_ioport);
706 706
707static 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
719static 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
724void __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
707#ifdef CONFIG_CHECK_CACHE_COHERENCY 731#ifdef CONFIG_CHECK_CACHE_COHERENCY
708/* 732/*
709 * For platforms that have configurable cache-coherency. This function 733 * For platforms that have configurable cache-coherency. This function
@@ -848,6 +872,9 @@ void __init setup_arch(char **cmdline_p)
848 /* Probe the machine type, establish ppc_md. */ 872 /* Probe the machine type, establish ppc_md. */
849 probe_machine(); 873 probe_machine();
850 874
875 /* Setup panic notifier if requested by the platform. */
876 setup_panic();
877
851 /* 878 /*
852 * Configure ppc_md.power_save (ppc32 only, 64-bit machines do 879 * Configure ppc_md.power_save (ppc32 only, 64-bit machines do
853 * it from their respective probe() function. 880 * it from their respective probe() function.
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 9dabea6e1443..6244bc849469 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -104,6 +104,20 @@ static void __noreturn ps3_halt(void)
104 ps3_sys_manager_halt(); /* never returns */ 104 ps3_sys_manager_halt(); /* never returns */
105} 105}
106 106
107static 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
107#if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \ 121#if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \
108 defined(CONFIG_PS3_FLASH) || defined(CONFIG_PS3_FLASH_MODULE) 122 defined(CONFIG_PS3_FLASH) || defined(CONFIG_PS3_FLASH_MODULE)
109static void __init prealloc(struct ps3_prealloc *p) 123static void __init prealloc(struct ps3_prealloc *p)
@@ -255,6 +269,7 @@ define_machine(ps3) {
255 .probe = ps3_probe, 269 .probe = ps3_probe,
256 .setup_arch = ps3_setup_arch, 270 .setup_arch = ps3_setup_arch,
257 .init_IRQ = ps3_init_IRQ, 271 .init_IRQ = ps3_init_IRQ,
272 .panic = ps3_panic,
258 .get_boot_time = ps3_get_boot_time, 273 .get_boot_time = ps3_get_boot_time,
259 .set_dabr = ps3_set_dabr, 274 .set_dabr = ps3_set_dabr,
260 .calibrate_decr = ps3_calibrate_decr, 275 .calibrate_decr = ps3_calibrate_decr,
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 5f1beb8367ac..a8531e012658 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -726,6 +726,7 @@ define_machine(pseries) {
726 .pcibios_fixup = pSeries_final_fixup, 726 .pcibios_fixup = pSeries_final_fixup,
727 .restart = rtas_restart, 727 .restart = rtas_restart,
728 .halt = rtas_halt, 728 .halt = rtas_halt,
729 .panic = rtas_os_term,
729 .get_boot_time = rtas_get_boot_time, 730 .get_boot_time = rtas_get_boot_time,
730 .get_rtc_time = rtas_get_rtc_time, 731 .get_rtc_time = rtas_get_rtc_time,
731 .set_rtc_time = rtas_set_rtc_time, 732 .set_rtc_time = rtas_set_rtc_time,