Skip to content

Commit

Permalink
[nrf fromtree] drivers: timer: nrf_grtc_timer: Fix for random hangs
Browse files Browse the repository at this point in the history
d599e2b removed early return from sys_clock_timeout_handler if
current counter value is less than cc_val. It seems that this return is
needed as after the removal some stress tests which were using system
timers heavily started to hang.

Signed-off-by: Krzysztof Chruściński <[email protected]>
(cherry picked from commit af3c8b9)
(cherry picked from commit a56fee6)
  • Loading branch information
nordic-krch authored and anangl committed Jul 1, 2024
1 parent 58a6d32 commit e1fd231
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/timer/nrf_grtc_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ static void sys_clock_timeout_handler(int32_t id, uint64_t cc_val, void *p_conte
ARG_UNUSED(id);
ARG_UNUSED(p_context);
uint64_t dticks;
uint64_t now = counter();

if (unlikely(now < cc_val)) {
return;
}

dticks = counter_sub(cc_val, last_count) / CYC_PER_TICK;

Expand Down

0 comments on commit e1fd231

Please sign in to comment.