Skip to content

Commit

Permalink
ARM: imx: return zero in case next event gets a large increment
Browse files Browse the repository at this point in the history
The return of v2_set_next_event() will lead to an infinite loop in
tick_handle_oneshot_broadcast() - "goto again;" with imx6q WAIT mode
(to be enabled).  This happens because when global event did not expire
any CPU local events, the broadcast device will be rearmed to a CPU
local next_event, which could be far away from now and result in a
max_delta_tick programming in set_next_event().

Fix the problem by detecting those next events with increments larger
than 0x7fffffff, and simply return zero in that case.

It leaves mx1_2_set_next_event() unchanged since only v2_set_next_event()
will be running with imx6q WAIT mode support.

Thanks Russell King for helping understand the problem.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
  • Loading branch information
Shawn Guo committed Jan 30, 2013
1 parent 1d7180e commit eea8e32
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/arm/mach-imx/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ static int v2_set_next_event(unsigned long evt,

__raw_writel(tcmp, timer_base + V2_TCMP);

return (int)(tcmp - __raw_readl(timer_base + V2_TCN)) < 0 ?
return evt < 0x7fffffff &&
(int)(tcmp - __raw_readl(timer_base + V2_TCN)) < 0 ?
-ETIME : 0;
}

Expand Down

0 comments on commit eea8e32

Please sign in to comment.