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

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


  Branch: refs/heads/master
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: b365ab45cbdfd953efb3689b48a1ba06875da808
      https://github.com/RIOT-OS/RIOT/commit/b365ab45cbdfd953efb3689b48a1ba06875da808
  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: 001fdc52754224a437685766fc502f1abee72d36
      https://github.com/RIOT-OS/RIOT/commit/001fdc52754224a437685766fc502f1abee72d36
  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 #3998 from gebart/pr/xtimer-long-term-fast-cpu-bug

sys/xtimer: Avoid race incrementing multiple periods in _timer_callback


Compare: https://github.com/RIOT-OS/RIOT/compare/d2a02ea582b1...001fdc527542


More information about the commits mailing list