powerpc/time: improve decrementer clockevent processing
authorNicholas Piggin <npiggin@gmail.com>
Mon, 24 Jan 2022 14:39:30 +0000 (00:39 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 16 Mar 2022 05:55:23 +0000 (16:55 +1100)
commit35de589cb8793573ed56a915af9cb4b5f15ad7d7
tree17b10fa12821ff0e3a094a67c972f68158e63a35
parentcf74ff52e352112be78c4c4c3637a37ec36a6608
powerpc/time: improve decrementer clockevent processing

The stop/shutdown op should not use decrementer_set_next_event because
that sets decrementers_next_tb to now + decrementer_max, which means a
decrementer interrupt that occurs after that time will call the
clockevent event handler unexpectedly. Set next_tb to ~0 here to prevent
any clock event call. Init all clockevents to stopped.

Then the decrementer clockevent device always has event_handler set and
applicable because we know the clock event device was not stopped. So
make this call unconditional to show that it is always called. next_tb
need not be set to ~0 before the event handler is called because it will
stop the clockevent device if there is no other timer.

Finally, the timer broadcast interrupt should not modify next_tb because
it is not involved with the local decrementer clockevent on this CPU.

This doesn't fix a known bug, just tidies the code.

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-3-npiggin@gmail.com
arch/powerpc/kernel/time.c