Commit 3494c166 authored by David S. Miller's avatar David S. Miller

[TICK] tick-common: Fix one-shot handling in tick_handle_periodic().

When clockevents_program_event() is given an expire time in the
past, it does not update dev->next_event, so this looping code
would loop forever once the first in-the-past expiration time
was used.

Keep advancing "next" locally to fix this bug.
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9e203bcc
...@@ -77,6 +77,7 @@ static void tick_periodic(int cpu) ...@@ -77,6 +77,7 @@ static void tick_periodic(int cpu)
void tick_handle_periodic(struct clock_event_device *dev) void tick_handle_periodic(struct clock_event_device *dev)
{ {
int cpu = smp_processor_id(); int cpu = smp_processor_id();
ktime_t next;
tick_periodic(cpu); tick_periodic(cpu);
...@@ -86,12 +87,12 @@ void tick_handle_periodic(struct clock_event_device *dev) ...@@ -86,12 +87,12 @@ void tick_handle_periodic(struct clock_event_device *dev)
* Setup the next period for devices, which do not have * Setup the next period for devices, which do not have
* periodic mode: * periodic mode:
*/ */
next = ktime_add(dev->next_event, tick_period);
for (;;) { for (;;) {
ktime_t next = ktime_add(dev->next_event, tick_period);
if (!clockevents_program_event(dev, next, ktime_get())) if (!clockevents_program_event(dev, next, ktime_get()))
return; return;
tick_periodic(cpu); tick_periodic(cpu);
next = ktime_add(next, tick_period);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment