]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/time: avoid programming DEC at the start of the timer interrupt
authorNicholas Piggin <npiggin@gmail.com>
Fri, 9 Sep 2022 14:24:57 +0000 (00:24 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 28 Sep 2022 09:22:09 +0000 (19:22 +1000)
commit08d21a27b8ef024300148f5fe8f42b3c40b4adb2
tree01e6315298d82269a479d78a7e08cae2405849b1
parent11813282704e71367857871006258b9ef7e15128
powerpc/time: avoid programming DEC at the start of the timer interrupt

Setting DEC to maximum at the start of the timer interrupt is not
necessary and can be avoided for performance when MSR[EE] is not
enabled during the handler as explained in commit 3bee53f48b43
("powerpc/64s/interrupt: Don't enable MSR[EE] in irq handlers unless
perf is in use"), where this change was first attempted.

The idea is that the timer interrupt runs with MSR[EE]=0, and at the end
of the interrupt DEC is programmed to the next timer interval, so there
is no need to clear the decrementer exception before then.

When the above commit was merged, that was not quite true. The low res
timer subsystem had some cases in the oneshot timer code where if the
tick was to be stopped and no timers active, the clock device would not
get the ->set_state_oneshot_stopped() call, so DEC would not get
reprogrammed, and this would hang taking continual timer interrupts.

So this was reverted in commit bc1c3caf1bbb ("powerpc/time: Always set
decrementer in timer_interrupt()"), which was a partial revert of the
above commit.

Commit e111cfc5c47d ("timers/nohz: Switch to ONESHOT_STOPPED in the
low-res handler when the tick is stopped") was later merged to fix this
missing case in the timer subsystem, so now the behaviour can be
restored.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220909142457.278032-1-npiggin@gmail.com
arch/powerpc/kernel/time.c