Commit 064996d6 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

powerpc/xmon: Avoid tripping SMP hardlockup watchdog

The SMP hardlockup watchdog cross-checks other CPUs for lockups, which
causes xmon headaches because it's assuming interrupts hard disabled
means no watchdog troubles. Try to improve that by calling
touch_nmi_watchdog() in obvious places where secondaries are spinning.

Also annotate these spin loops with spin_begin/end calls.
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 80e4d70b
...@@ -530,14 +530,19 @@ static int xmon_core(struct pt_regs *regs, int fromipi) ...@@ -530,14 +530,19 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
waiting: waiting:
secondary = 1; secondary = 1;
spin_begin();
while (secondary && !xmon_gate) { while (secondary && !xmon_gate) {
if (in_xmon == 0) { if (in_xmon == 0) {
if (fromipi) if (fromipi) {
spin_end();
goto leave; goto leave;
}
secondary = test_and_set_bit(0, &in_xmon); secondary = test_and_set_bit(0, &in_xmon);
} }
barrier(); spin_cpu_relax();
touch_nmi_watchdog();
} }
spin_end();
if (!secondary && !xmon_gate) { if (!secondary && !xmon_gate) {
/* we are the first cpu to come in */ /* we are the first cpu to come in */
...@@ -568,21 +573,25 @@ static int xmon_core(struct pt_regs *regs, int fromipi) ...@@ -568,21 +573,25 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
mb(); mb();
xmon_gate = 1; xmon_gate = 1;
barrier(); barrier();
touch_nmi_watchdog();
} }
cmdloop: cmdloop:
while (in_xmon) { while (in_xmon) {
if (secondary) { if (secondary) {
spin_begin();
if (cpu == xmon_owner) { if (cpu == xmon_owner) {
if (!test_and_set_bit(0, &xmon_taken)) { if (!test_and_set_bit(0, &xmon_taken)) {
secondary = 0; secondary = 0;
spin_end();
continue; continue;
} }
/* missed it */ /* missed it */
while (cpu == xmon_owner) while (cpu == xmon_owner)
barrier(); spin_cpu_relax();
} }
barrier(); spin_cpu_relax();
touch_nmi_watchdog();
} else { } else {
cmd = cmds(regs); cmd = cmds(regs);
if (cmd != 0) { if (cmd != 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment