Message ID | 20220124143930.3923442-1-npiggin@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [1/3] powerpc/64s/interrupt: Fix decrementer storm | expand |
On Tue, 25 Jan 2022 00:39:28 +1000, Nicholas Piggin wrote: > The decrementer exception can fail to be cleared when the interrupt > returns in the case where the decrementer wraps with the next timer > still beyond decrementer_max. This results in a decrementer interrupt > storm. This is triggerable with small decrementer system with hard > and soft watchdogs disabled. > > Fix this by always programming the decrementer if there was no timer. > > [...] Patch 1 applied to powerpc/fixes. [1/3] powerpc/64s/interrupt: Fix decrementer storm https://git.kernel.org/powerpc/c/8defc2a5dd8f4c0cb19ecbaca8d3e89ab98524da cheers
On Tue, 25 Jan 2022 00:39:28 +1000, Nicholas Piggin wrote: > The decrementer exception can fail to be cleared when the interrupt > returns in the case where the decrementer wraps with the next timer > still beyond decrementer_max. This results in a decrementer interrupt > storm. This is triggerable with small decrementer system with hard > and soft watchdogs disabled. > > Fix this by always programming the decrementer if there was no timer. > > [...] Patch 2 & 3 applied to powerpc/next. [2/3] powerpc/time: Fix KVM host re-arming a timer beyond decrementer range https://git.kernel.org/powerpc/c/cf74ff52e352112be78c4c4c3637a37ec36a6608 [3/3] powerpc/time: improve decrementer clockevent processing https://git.kernel.org/powerpc/c/35de589cb8793573ed56a915af9cb4b5f15ad7d7 cheers
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 62361cc7281c..cd0b8b71ecdd 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -649,8 +649,9 @@ DEFINE_INTERRUPT_HANDLER_ASYNC(timer_interrupt) __this_cpu_inc(irq_stat.timer_irqs_event); } else { now = *next_tb - now; - if (now <= decrementer_max) - set_dec_or_work(now); + if (now > decrementer_max) + now = decrementer_max; + set_dec_or_work(now); __this_cpu_inc(irq_stat.timer_irqs_others); }
The decrementer exception can fail to be cleared when the interrupt returns in the case where the decrementer wraps with the next timer still beyond decrementer_max. This results in a decrementer interrupt storm. This is triggerable with small decrementer system with hard and soft watchdogs disabled. Fix this by always programming the decrementer if there was no timer. Fixes: 0faf20a1ad16 ("powerpc/64s/interrupt: Don't enable MSR[EE] in irq handlers unless perf is in use") Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> --- arch/powerpc/kernel/time.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)