[Devel] [PATCH RH7] fence-watchdog: return back message printing about fencing

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Wed Sep 14 03:10:13 PDT 2016


Use stock panic for crash and schedule work for reboot:

We've temporary stopped printing the message about fencing
as that caused problems in video card driver which needs to
vmalloc but can not do so in_interrupt() context.(reproduces
rarely 1/10 when triger fence watchdog from net_rx_action)

So now we try to use stock panic's print to deliver message
about fencing in kernel log.(checked 20 times - no reproduce)

Also we need to print message for reboot action, for that matter
we can schedule work for it same as for poweroff action as all
outgoing network packets will be droped after time exhausted.

Pity that when call panic we will not get modules list as in
oops, all other relevant info seem to stay in current output.

https://jira.sw.ru/browse/PSBM-50006
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 kernel/fence-watchdog.c | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/kernel/fence-watchdog.c b/kernel/fence-watchdog.c
index 622cd53..f5c2347f 100644
--- a/kernel/fence-watchdog.c
+++ b/kernel/fence-watchdog.c
@@ -42,36 +42,31 @@ DEFINE_VVAR(volatile unsigned long, fence_wdog_jiffies64) = MAX_U64;
 static int fence_wdog_action = FENCE_WDOG_CRASH;
 static atomic_t not_fenced = ATOMIC_INIT(-1);
 
-static void do_halt(struct work_struct *dummy)
+static void do_halt_or_reboot(struct work_struct *dummy)
 {
 	printk(KERN_EMERG"fence-watchdog: %s\n",
 	       action_names[fence_wdog_action]);
-	kernel_halt();
-}
-
-static DECLARE_WORK(halt_work, do_halt);
-
-void fence_wdog_do_fence(void)
-{
-	char *killer = NULL;
-
 	switch (fence_wdog_action) {
-	case FENCE_WDOG_CRASH:
-		panic_on_oops = 1;
-		wmb();
-		*killer = 1;
-		break;
 	case FENCE_WDOG_REBOOT:
-		lockdep_off();
-		local_irq_enable();
 		emergency_restart();
 		break;
 	case FENCE_WDOG_POWEROFF:
-		schedule_work(&halt_work);
+		kernel_halt();
 		break;
 	}
 }
 
+static DECLARE_WORK(halt_or_reboot_work, do_halt_or_reboot);
+
+void fence_wdog_do_fence(void)
+{
+	if (fence_wdog_action == FENCE_WDOG_CRASH)
+		panic("fence-watchdog: %s\n",
+		      action_names[fence_wdog_action]);
+	else
+		schedule_work(&halt_or_reboot_work);
+}
+
 inline int fence_wdog_check_timer(void)
 {
 	if (unlikely(get_jiffies_64() > fence_wdog_jiffies64 &&
-- 
2.5.5



More information about the Devel mailing list