]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/64s/interrupt: Fix decrementer storm
authorNicholas Piggin <npiggin@gmail.com>
Mon, 24 Jan 2022 14:39:28 +0000 (00:39 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 25 Jan 2022 05:50:10 +0000 (16:50 +1100)
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: 3bee53f48b43 ("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>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220124143930.3923442-1-npiggin@gmail.com
arch/powerpc/kernel/time.c

index 62361cc7281cd74f2fe5aab0e6df36e0098cdaba..cd0b8b71ecddc15b9250b326b1e03a36b26e96c2 100644 (file)
@@ -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);
        }