aboutsummaryrefslogtreecommitdiffstats
path: root/lib/nmi_backtrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nmi_backtrace.c')
-rw-r--r--lib/nmi_backtrace.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
index 9813a983d024..f9e89001b52e 100644
--- a/lib/nmi_backtrace.c
+++ b/lib/nmi_backtrace.c
@@ -89,22 +89,22 @@ bool nmi_cpu_backtrace(struct pt_regs *regs)
unsigned long flags;
if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
+ /*
+ * Allow nested NMI backtraces while serializing
+ * against other CPUs.
+ */
+ printk_cpu_lock_irqsave(flags);
if (!READ_ONCE(backtrace_idle) && regs && cpu_in_idle(instruction_pointer(regs))) {
pr_warn("NMI backtrace for cpu %d skipped: idling at %pS\n",
cpu, (void *)instruction_pointer(regs));
} else {
- /*
- * Allow nested NMI backtraces while serializing
- * against other CPUs.
- */
- printk_cpu_lock_irqsave(flags);
pr_warn("NMI backtrace for cpu %d\n", cpu);
if (regs)
show_regs(regs);
else
dump_stack();
- printk_cpu_unlock_irqrestore(flags);
}
+ printk_cpu_unlock_irqrestore(flags);
cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask));
return true;
}