[riot-commits] [RIOT-OS/RIOT] 04f719: sys/xtimer: Avoid race incrementing multiple perio...

Martine Lenders authmillenon at gmail.com
Wed Sep 30 12:40:18 CEST 2015


  Branch: refs/heads/2015.09-branch
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: 04f7190e16dcec87e5b6a22f9fb1a7081c3ec8f0
      https://github.com/RIOT-OS/RIOT/commit/04f7190e16dcec87e5b6a22f9fb1a7081c3ec8f0
  Author: Joakim NohlgÄrd <joakim.gebart at eistec.se>
  Date:   2015-09-30 (Wed, 30 Sep 2015)

  Changed paths:
    M sys/xtimer/xtimer_core.c

  Log Message:
  -----------
  sys/xtimer: Avoid race incrementing multiple periods in _timer_callback

On a fast CPU with a slow timer (e.g. XTIMER_SHIFT > 0) it is possible
that now == _xtimer_now() when spinning for the overflow. In the extreme
case When this happens _next_period() will be called more than once
until the timer overflows for real.

Fault observed in real life when running on a 32.768 kHz timer on a
~96 MHz clocked mulle (Kinetis K60, Cortex-M4). _next_period() was
called 9 times during the same ISR call before the 32 kHz timer
overflowed.


  Commit: 49181f4dae6a600d6304f7e38a6746270ae0aec0
      https://github.com/RIOT-OS/RIOT/commit/49181f4dae6a600d6304f7e38a6746270ae0aec0
  Author: Martine Lenders <authmillenon at gmail.com>
  Date:   2015-09-30 (Wed, 30 Sep 2015)

  Changed paths:
    M sys/xtimer/xtimer_core.c

  Log Message:
  -----------
  Merge pull request #4000 from gebart/pr/xtimer-long-term-fast-cpu-bug-2015.09

sys/xtimer: Avoid race incrementing multiple periods in _timer_callback


Compare: https://github.com/RIOT-OS/RIOT/compare/d04e5ac812a6...49181f4dae6a


More information about the commits mailing list