sys/xtimer: Avoid race incrementing multiple periods in _timer_callback#4000
Merged
miri64 merged 1 commit intoRIOT-OS:2015.09-branchfrom Sep 30, 2015
Conversation
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.
Contributor
|
HAPPY 4000 everyone!! 🍻 |
Member
|
Change was ACK'd by @kaspar030 in #3998 already, so ACK here too. |
miri64
added a commit
that referenced
this pull request
Sep 30, 2015
…-2015.09 sys/xtimer: Avoid race incrementing multiple periods in _timer_callback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
2015.09 release version of #3998
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.