sys/xtimer: compare two offsets rather than absolute times#13212
sys/xtimer: compare two offsets rather than absolute times#13212MichelRottleuthner merged 1 commit intoRIOT-OS:masterfrom
Conversation
|
I'm testing this PR on iotlab using the testing procedure described in #13209. There are 2 nodes: one running this PR and the other one running with master. I expect master will crash after some time and hope this PR won't. Let's wait a bit for some results. |
sys/xtimer/xtimer_core.c
Outdated
| uint32_t elapsed = timerB->start_time - timerA->start_time; | ||
| /* it is necessary to compare two offsets, instead of two absolute times | ||
| * two conditions: (1) timerA was already expired before timerB starts | ||
| * (2) timerA will expire ealier than or equal to timerB |
There was a problem hiding this comment.
| * (2) timerA will expire ealier than or equal to timerB | |
| * (2) timerA will expire earlier than or equal to timerB |
|
The node running the master version already crashed. The one running this PR is still alive. Let's wait a couple of hours more. |
|
@aabadie can you try to reproduce it with the steps of my comment int the related Issue? |
|
I can reproduce the crash in |
|
Also tested on 8bit: |
Well, it didn't crash earlier with your patch @MichelRottleuthner but it did. Using this PR, for the moment the border router is still running. So from what I've tried so far, this PR seems to solve the problem reported in #13209. |
@MichelRottleuthner does the issue fix here match what you sometimes saw when testing #9530? Otherwise do you ACK the changes? |
sys/xtimer/xtimer_core.c
Outdated
|
|
||
| /** | ||
| * @brief compare two timers. return true if timerA expires earlier than or equal to timerB and false otherwise. | ||
| * assume that timerB starts later than timerA. |
There was a problem hiding this comment.
Can this be safely assumed here in any case?
If not 100% sure, I'd prefer to add an explicit check for the start times to make it a proper compare function without any preconditions.
Yes, it looks like it solves that. The only thing that bothers me a little, is the compare function having a precondition that is not absolutely needed and can be overlooked easily. Looks like a good entry point for the next bug ;) |
Hyungsin
left a comment
There was a problem hiding this comment.
The only thing that bothers me a little, is the compare function having a precondition that is not absolutely needed and can be overlooked easily. Looks like a good entry point for the next bug ;)
Added another commit to resolve this issue. Thanks!
|
After the last changes I tested this PR again on |
6e70ae4 to
eadd4c9
Compare
|
@MichelRottleuthner Thanks for the effort. We have only one (#13103) remaining now :) |
Contribution description
This PR fixes a bug in #9530 reported by #13209, making sure to compare two offsets rather than two absolute times when ordering timers.
Testing procedure
Issues/PRs references
#9530
#13209