Skip to content

Conversation

jnohlgard
Copy link
Member

@jnohlgard jnohlgard commented Sep 20, 2017

Avoids a possible race condition in xtimer_set, xtimer_periodic where the target time will have already passed when execution reaches the _xtimer_now() call inside _xtimer_set_absolute. The race condition is more easily triggered in xtimer_periodic because of the longer execution time, but it is possible inside xtimer_set as well if an interrupt arrives before the _xtimer_set_absolute call and the ISR is non-trivial, and/or a context switch is triggered by the ISR.

Based on top of #7496, #7628

Joakim Nohlgård added 10 commits September 19, 2017 14:01
When the target is inside the next long_period, the previous condition
was incorrect. The new condition should give the same result regardless
of whether there is a long_period tick coming soon or not.
Avoids a possible race condition in xtimer_set, xtimer_periodic where
the target time will have already passed when execution reaches the
_xtimer_now() call inside _xtimer_set_absolute.

The race condition is more easily triggered in xtimer_periodic because
of the longer execution time, but it is possible inside xtimer_set as
well if an interrupt arrives before the _xtimer_set_absolute call
and the ISR is non-trivial, and/or a context switch is triggered by
the ISR.
@jnohlgard jnohlgard added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: timers Area: timer subsystems State: waiting for other PR State: The PR requires another PR to be merged first labels Sep 20, 2017
@jnohlgard jnohlgard added this to the Release 2017.10 milestone Sep 20, 2017
@stale
Copy link

stale bot commented Aug 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Aug 10, 2019
@stale stale bot closed this Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: timers Area: timer subsystems State: stale State: The issue / PR has no activity for >185 days State: waiting for other PR State: The PR requires another PR to be merged first Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants