-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TSCH: fix a bug in slot scheduling #2140
base: master
Are you sure you want to change the base?
Conversation
Hmm, I have seen something similar, I wonder if that was the same issue or not. I think the problem was when skipping a slot (lock or non-active slot), we would directly try and schedule the next slot, although we had not even reached the real start of the current timeslot (we'd be 1 or 2 ticks before, but now looking at |
Now about the fix: I'm worried that in cases we really did miss the deadline (e.g. join, or any slot operation that took too long), we'll end up busy-waiting (wait for a rtimer wrap) |
@simonduq that sounds like another thing that would trigger the same behavior: the bug here is triggered because it looks like (As a side note, I feel that this sort of thing, the core operation of TSCH, is crying for a randomized brute force testing...)
The waiting will happen while |
I love the idea :)
Right, but the problem remains whenever |
I think it's a reasonable assumption to make that the scheduling will not be missed by more than 1 second, even on msp430. |
Right, I agree. 👍 |
The scheduling of a new TSCH timeslot at the end of
tsch_slot_operation()
will enter a count-to-infinity loop if called less or equal-toRTIMER_GUARD
ticks before the start of the next TSCH timeslot (i.e. 1 or 2 ticks on most platforms on whichRTIMER_GUARD==2
). This patch fixes this behavior by busywaiting until the start of the next slot in that case.In order to avoid double busywaiting, the busywait code is now executed in
TSCH_SCHEDULE_AND_YIELD
if and only if it was not done intsch_schedule_slot_operation()
.This code was developed as part of the SPHERE project (http://irc-sphere.ac.uk/)