hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/kernel/watchdog_hld.c
....@@ -24,6 +24,8 @@
2424 static DEFINE_PER_CPU(bool, watchdog_nmi_touch);
2525 static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
2626 static DEFINE_PER_CPU(struct perf_event *, dead_event);
27
+static DEFINE_RAW_SPINLOCK(watchdog_output_lock);
28
+
2729 static struct cpumask dead_events_mask;
2830
2931 static unsigned long hardlockup_allcpu_dumped;
....@@ -134,6 +136,13 @@
134136 /* only print hardlockups once */
135137 if (__this_cpu_read(hard_watchdog_warn) == true)
136138 return;
139
+ /*
140
+ * If early-printk is enabled then make sure we do not
141
+ * lock up in printk() and kill console logging:
142
+ */
143
+ printk_kill();
144
+
145
+ raw_spin_lock(&watchdog_output_lock);
137146
138147 pr_emerg("Watchdog detected hard LOCKUP on cpu %d", this_cpu);
139148 print_modules();
....@@ -151,6 +160,7 @@
151160 !test_and_set_bit(0, &hardlockup_allcpu_dumped))
152161 trigger_allbutself_cpu_backtrace();
153162
163
+ raw_spin_unlock(&watchdog_output_lock);
154164 if (hardlockup_panic)
155165 nmi_panic(regs, "Hard LOCKUP");
156166