Skip to contentSkip to conversation

softdog: Obey hardlockup_all_cpu_backtrace sysctl

PATCH New Daniel Vetter 3 participants 4 messages Oct 11, 2017 Watchdog device drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 softdog: Obey hardlockup_all_cpu_backtrace sysctl

This is used by the nmi watchdog, but also useful by the softdog when we're trying to figure out where exactly we're stuck.

Cc: Chris Wilson <[email protected]>
Cc: Imre Deak <[email protected]>
References: https://bugs.freedesktop.org/show_bug.cgi?id=103160

---

FIXME: Take the && 1 out once CI is configured to enable this. -Daniel

---
 drivers/watchdog/softdog.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/watchdog/softdog.c +2 -0
index 060740625485..3a1606011b17 100644
@@ -63,6 +63,8 @@ static enum hrtimer_restart softdog_fire(struct hrtimer *timer)
 		pr_crit("Triggered - Reboot ignored\n");
 	} else if (soft_panic) {
 		pr_crit("Initiating panic\n");
+		if (sysctl_hardlockup_all_cpu_backtrace && 1)
+			trigger_allbutself_cpu_backtrace();
 		panic("Software Watchdog Timer expired");
 	} else {
 		pr_crit("Initiating system reboot\n");
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: failure for softdog: Obey hardlockup_all_cpu_backtrace sysctl

== Series Details ==

== Series Details ==

Series: softdog: Obey hardlockup_all_cpu_backtrace sysctl
URL : https://patchwork.freedesktop.org/series/31751/
State : failure

== Summary ==

  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     scripts/mod/devicetable-offsets.h
  CHK     include/generated/compile.h
  CHK     kernel/config_data.h
  AR      drivers/watchdog/watchdog.o
  CC      drivers/watchdog/softdog.o
drivers/watchdog/softdog.c: In function ‘softdog_fire’:
drivers/watchdog/softdog.c:66:7: error: ‘sysctl_hardlockup_all_cpu_backtrace’ undeclared (first use in this function)
   if (sysctl_hardlockup_all_cpu_backtrace && 1)
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/watchdog/softdog.c:66:7: note: each undeclared identifier is reported only once for each function it appears in
drivers/watchdog/softdog.c:67:4: error: implicit declaration of function ‘trigger_allbutself_cpu_backtrace’ [-Werror=implicit-function-declaration]
    trigger_allbutself_cpu_backtrace();
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors scripts/Makefile.build:313: recipe for target 'drivers/watchdog/softdog.o' failed make[2]: *** [drivers/watchdog/softdog.o] Error 1 scripts/Makefile.build:572: recipe for target 'drivers/watchdog' failed make[1]: *** [drivers/watchdog] Error 2
Makefile:1019: recipe for target 'drivers' failed
make: *** [drivers] Error 2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

PATCH 1/1 softdog-info

In reply to Daniel Vetter

Excuse the lack of context here, I have a headache.

References: https://bugs.freedesktop.org/show_bug.cgi?id=103160

---
 drivers/watchdog/softdog.c |  2 ++
 include/linux/watchdog.h   |  9 +++++++++
 kernel/watchdog.c          | 39 ++++++++++++++++++++++++---------------
 3 files changed, 35 insertions(+), 15 deletions(-)
drivers/watchdog/softdog.c +2 -0
index 060740625485..61b0bd333114 100644
@@ -58,6 +58,8 @@ static struct hrtimer softdog_preticktock;
 
 static enum hrtimer_restart softdog_fire(struct hrtimer *timer)
 {
+	watchdog_softlockup(NULL, true);
+
 	module_put(THIS_MODULE);
 	if (soft_noboot) {
 		pr_crit("Triggered - Reboot ignored\n");
include/linux/watchdog.h +9 -0
index a786e5e8973b..811e15e08718 100644
@@ -215,4 +215,13 @@ extern void watchdog_unregister_device(struct watchdog_device *);
 /* devres register variant */
 int devm_watchdog_register_device(struct device *dev, struct watchdog_device *);
 
+#if IS_ENABLED(CONFIG_LOCKUP_DETECTOR)
+extern void watchdog_softlockup(struct pt_regs *regs, bool show_backtrace);
+#else
+static inline void watchdog_softlockup(struct pt_regs *regs,
+				       bool show_backtrace)
+{
+}
+#endif
+
 #endif  /* ifndef _LINUX_WATCHDOG_H */
kernel/watchdog.c +24 -15
index 6bcb854909c0..a111c4d34798 100644
@@ -24,6 +24,7 @@
 #include <linux/workqueue.h>
 #include <linux/sched/clock.h>
 #include <linux/sched/debug.h>
+#include <linux/watchdog.h>
 
 #include <asm/irq_regs.h>
 #include <linux/kvm_para.h>
@@ -415,30 +416,21 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
 		}
 
 		pr_emerg("BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n",
-			smp_processor_id(), duration,
-			current->comm, task_pid_nr(current));
-		__this_cpu_write(softlockup_task_ptr_saved, current);
-		print_modules();
-		print_irqtrace_events(current);
-		if (regs)
-			show_regs(regs);
-		else
-			dump_stack();
+			 smp_processor_id(), duration,
+			 current->comm, task_pid_nr(current));
+
+		watchdog_softlockup(regs, softlockup_all_cpu_backtrace);
+		if (softlockup_panic)
+			panic("softlockup: hung tasks");
 
 		if (softlockup_all_cpu_backtrace) {
 			/* Avoid generating two back traces for current
 			 * given that one is already made above
 			 */
-			trigger_allbutself_cpu_backtrace();
-
 			clear_bit(0, &soft_lockup_nmi_warn);
 			/* Barrier to sync with other cpus */
 			smp_mb__after_atomic();
 		}
-
-		add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK);
-		if (softlockup_panic)
-			panic("softlockup: hung tasks");
 		__this_cpu_write(soft_watchdog_warn, true);
 	} else
 		__this_cpu_write(soft_watchdog_warn, false);
@@ -787,3 +779,20 @@ void __init lockup_detector_init(void)
 		nmi_watchdog_available = true;
 	lockup_detector_setup();
 }
+
+void watchdog_softlockup(struct pt_regs *regs, bool show_backtrace)
+{
+	__this_cpu_write(softlockup_task_ptr_saved, current);
+	print_modules();
+	print_irqtrace_events(current);
+	if (regs)
+		show_regs(regs);
+	else
+		dump_stack();
+
+	if (show_backtrace)
+		trigger_allbutself_cpu_backtrace();
+
+	add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK);
+}
+EXPORT_SYMBOL(watchdog_softlockup);
Signature · 6 lines
2.15.0.rc0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

✗ Fi.CI.BAT: warning for softdog: Obey hardlockup_all_cpu_backtrace sysctl (rev2)

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: softdog: Obey hardlockup_all_cpu_backtrace sysctl (rev2)
URL : https://patchwork.freedesktop.org/series/31751/
State : warning

== Summary ==

Series 31751v2 softdog: Obey hardlockup_all_cpu_backtrace sysctl
https://patchwork.freedesktop.org/api/1.0/series/31751/revisions/2/mbox/

Test chamelium:

        Subgroup dp-crc-fast:
                fail       -> PASS       (fi-kbl-7500u) fdo#102514
Test kms_frontbuffer_tracking:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-bdw-5557u) fdo#102473
Test pm_rpm:
        Subgroup basic-rte:
                pass       -> SKIP       (fi-hsw-4770r)

fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#102473 https://bugs.freedesktop.org/show_bug.cgi?id=102473

fi-bdw-5557u     total:289  pass:267  dwarn:1   dfail:0   fail:0   skip:21  time:453s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:472s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:391s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:573s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:284s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:517s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:523s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:537s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:517s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:565s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:626s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:431s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:274s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:597s
fi-hsw-4770r     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:439s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:464s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:504s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:473s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:506s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:581s
fi-kbl-7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20  time:493s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:590s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:658s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:466s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:653s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:530s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:514s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:472s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:576s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:431s

8a09bc166a311443214f03b7f5b379fc21783af1 drm-tip: 2017y-10m-11d-16h-00m-59s UTC integration manifest bc818a03c9a0 softdog-info

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5996/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx