powerpc/watchdog: Improve watchdog lock primitive
authorNicholas Piggin <npiggin@gmail.com>
Wed, 9 Aug 2017 12:41:22 +0000 (22:41 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 9 Aug 2017 13:45:28 +0000 (23:45 +1000)
commitd8e2a4053574002135fbb032c2e74f1d1dbb2103
treee6396da68551d99e4fa19444ad044dd7f18f80f8
parent0459ddfdb31e7d812b555a2530ecbacdf96961a6
powerpc/watchdog: Improve watchdog lock primitive

- Hard-disable interrupts before taking the lock, which prevents
  soft-NMI re-entrancy and therefore can prevent deadlocks.
- Use raw_ variants of local_irq_disable to avoid irq debugging.
- When the lock is contended, spin at low SMT priority, using
  loads only, and with interrupts enabled (where possible).

Some stalls have been noticed at high loads that go away with improved
locking. There should not be so much locking contention in the first
place (which is addressed in a subsequent patch), but locking should
still be improved.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/watchdog.c