| .. | .. |
|---|
| 24 | 24 | static DEFINE_PER_CPU(bool, watchdog_nmi_touch); |
|---|
| 25 | 25 | static DEFINE_PER_CPU(struct perf_event *, watchdog_ev); |
|---|
| 26 | 26 | static DEFINE_PER_CPU(struct perf_event *, dead_event); |
|---|
| 27 | +static DEFINE_RAW_SPINLOCK(watchdog_output_lock); |
|---|
| 28 | + |
|---|
| 27 | 29 | static struct cpumask dead_events_mask; |
|---|
| 28 | 30 | |
|---|
| 29 | 31 | static unsigned long hardlockup_allcpu_dumped; |
|---|
| .. | .. |
|---|
| 134 | 136 | /* only print hardlockups once */ |
|---|
| 135 | 137 | if (__this_cpu_read(hard_watchdog_warn) == true) |
|---|
| 136 | 138 | 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); |
|---|
| 137 | 146 | |
|---|
| 138 | 147 | pr_emerg("Watchdog detected hard LOCKUP on cpu %d", this_cpu); |
|---|
| 139 | 148 | print_modules(); |
|---|
| .. | .. |
|---|
| 151 | 160 | !test_and_set_bit(0, &hardlockup_allcpu_dumped)) |
|---|
| 152 | 161 | trigger_allbutself_cpu_backtrace(); |
|---|
| 153 | 162 | |
|---|
| 163 | + raw_spin_unlock(&watchdog_output_lock); |
|---|
| 154 | 164 | if (hardlockup_panic) |
|---|
| 155 | 165 | nmi_panic(regs, "Hard LOCKUP"); |
|---|
| 156 | 166 | |
|---|