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

Submitted by Pavel Tikhomirov on Sept. 14, 2016, 10:10 a.m.

Details

Message ID 1473847813-17870-1-git-send-email-ptikhomirov@virtuozzo.com
State New
Series "fence-watchdog: return back message printing about fencing"
Headers show

Commit Message

Pavel Tikhomirov Sept. 14, 2016, 10:10 a.m.
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@virtuozzo.com>
---
 kernel/fence-watchdog.c | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)

Patch hide | download patch | download mbox

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 &&

Comments

Kirill Tkhai Sept. 14, 2016, 3:08 p.m.
On 14.09.2016 13:10, Pavel Tikhomirov wrote:
> 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@virtuozzo.com>

Acked-by: Kirill Tkhai <ktkhai@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 &&
>