From: Anton Blanchard <hidden> Date: 2014-08-05 04:54:59
xmon only soft disables interrupts. This seems like a bad idea - we
certainly don't want decrementer and PMU exceptions going off when
we are debugging something inside xmon.
This issue was uncovered when the hard lockup detector went off
inside xmon. To ensure we wont get a spurious hard lockup warning,
I also call touch_nmi_watchdog() when exiting xmon.
Signed-off-by: Anton Blanchard <redacted>
---
Index: b/arch/powerpc/xmon/xmon.c
===================================================================
From: Anton Blanchard <hidden> Date: 2014-08-05 04:56:20
The hard lockup detector uses a PMU event as a periodic NMI to
detect if we are stuck (where stuck means no timer interrupts have
occurred).
Ben's rework of the ppc64 soft disable code has made ppc64 PMU
exceptions a partial NMI. They can get disabled if an external interrupt
comes in, but otherwise PMU interrupts will fire in interrupt disabled
regions.
I wrote a kernel module to test this patch and noticed we sometimes
missed hard lockup warnings. The RCU code detected the stall first and
issued an IPI to backtrace all CPUs. Unfortunately an IPI is an external
interrupt and that will hard disable interrupts, preventing the hard
lockup detector from going off.
If I reduced the hard lockup threshold to 5 seconds:
echo 5 > /proc/sys/kernel/watchdog_thresh
Then it would beat the RCU code in detecting a stall and get a
correct backtrace out.
Another downside is that our PMCs can only count to 2^31, so even when
we ask for 10 seconds of processor cycles, we end up taking a couple
of PMU exceptions a second.
Signed-off-by: Anton Blanchard <redacted>
---
Index: b/arch/powerpc/Kconfig
===================================================================
From: Anton Blanchard <hidden> Date: 2014-08-11 23:31:38
The hard lockup detector uses a PMU event as a periodic NMI to
detect if we are stuck (where stuck means no timer interrupts have
occurred).
Ben's rework of the ppc64 soft disable code has made ppc64 PMU
exceptions a partial NMI. They can get disabled if an external interrupt
comes in, but otherwise PMU interrupts will fire in interrupt disabled
regions.
I wrote a kernel module to test this patch and noticed we sometimes
missed hard lockup warnings. The RCU code detected the stall first and
issued an IPI to backtrace all CPUs. Unfortunately an IPI is an external
interrupt and that will hard disable interrupts, preventing the hard
lockup detector from going off.
If I reduced the hard lockup threshold to 5 seconds:
echo 5 > /proc/sys/kernel/watchdog_thresh
Then it would beat the RCU code in detecting a stall and get a
correct backtrace out.
Another downside is that our PMCs can only count to 2^31, so even when
we ask for 10 seconds of processor cycles, we end up taking a couple
of PMU exceptions a second.
Signed-off-by: Anton Blanchard <redacted>
---
v2: Mikey noticed a build issue with oprofile. Since our NMI is just
the PMU hardware it doesn't make any sense for oprofile to try and
use it.
Index: b/arch/powerpc/Kconfig
===================================================================
From: Paul E. McKenney <hidden> Date: 2014-08-11 23:42:25
On Tue, Aug 12, 2014 at 09:31:37AM +1000, Anton Blanchard wrote:
The hard lockup detector uses a PMU event as a periodic NMI to
detect if we are stuck (where stuck means no timer interrupts have
occurred).
Ben's rework of the ppc64 soft disable code has made ppc64 PMU
exceptions a partial NMI. They can get disabled if an external interrupt
comes in, but otherwise PMU interrupts will fire in interrupt disabled
regions.
I wrote a kernel module to test this patch and noticed we sometimes
missed hard lockup warnings. The RCU code detected the stall first and
issued an IPI to backtrace all CPUs. Unfortunately an IPI is an external
interrupt and that will hard disable interrupts, preventing the hard
lockup detector from going off.
If it helps, commit bc1dce514e9b (rcu: Don't use NMIs to dump other
CPUs' stacks) makes RCU avoid this behavior. It instead reads the
stacks out remotely when this commit is applied. It is in -tip, and
should make mainline this merge window. Corresponding patch below.
Thanx, Paul
------------------------------------------------------------------------
rcu: Don't use NMIs to dump other CPUs' stacks
Although NMI-based stack dumps are in principle more accurate, they are
also more likely to trigger deadlocks. This commit therefore replaces
all uses of trigger_all_cpu_backtrace() with rcu_dump_cpu_stacks(), so
that the CPU detecting an RCU CPU stall does the stack dumping.
Signed-off-by: Paul E. McKenney <redacted>
Reviewed-by: Lai Jiangshan <redacted>