Skip to content

Commit

Permalink
powerpc/xmon: Avoid tripping SMP hardlockup watchdog
Browse files Browse the repository at this point in the history
[ Upstream commit 064996d ]

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: Nicholas Piggin <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
npiggin authored and gregkh committed Dec 25, 2017
1 parent f5fec05 commit 97f41b4
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions arch/powerpc/xmon/xmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,14 +530,19 @@ static int xmon_core(struct pt_regs *regs, int fromipi)

waiting:
secondary = 1;
spin_begin();
while (secondary && !xmon_gate) {
if (in_xmon == 0) {
if (fromipi)
if (fromipi) {
spin_end();
goto leave;
}
secondary = test_and_set_bit(0, &in_xmon);
}
barrier();
spin_cpu_relax();
touch_nmi_watchdog();
}
spin_end();

if (!secondary && !xmon_gate) {
/* we are the first cpu to come in */
Expand Down Expand Up @@ -568,21 +573,25 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
mb();
xmon_gate = 1;
barrier();
touch_nmi_watchdog();
}

cmdloop:
while (in_xmon) {
if (secondary) {
spin_begin();
if (cpu == xmon_owner) {
if (!test_and_set_bit(0, &xmon_taken)) {
secondary = 0;
spin_end();
continue;
}
/* missed it */
while (cpu == xmon_owner)
barrier();
spin_cpu_relax();
}
barrier();
spin_cpu_relax();
touch_nmi_watchdog();
} else {
cmd = cmds(regs);
if (cmd != 0) {
Expand Down

0 comments on commit 97f41b4

Please sign in to comment.