-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
tests: test for prio inversion using msg_send_recv #9306
base: master
Are you sure you want to change the base?
tests: test for prio inversion using msg_send_recv #9306
Conversation
Event 3: t1 - sending msg to t3 (msg_send_receive) | ||
Event 4: t3 - received message | ||
Event 5: t3 - sending reply | ||
Event 6: t1 - received reply |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reckon this is starvation, rather than priority inversion. Reason is that the medium priority thread prevents the low thread from running even before the message is sent, rather than pre-empting it while it's handling the message. Priority inversion would involve the second one - i.e. indirect pre-emption of a higher priority thread.
An example displaying priority inversion with messages would involve the high thread sending the message to the low thread, and the low thread receiving it and doing some action before sending. But while that action is happening, the medium thread comes along and pre-empts the low thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, will fix.
puts("TEST OUTPUT:"); | ||
|
||
/* create threads */ | ||
for (unsigned i = 0; i < T_NUMOF; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO separating out three "high", "medium" and "low" named threads was nicer for readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
return NULL; | ||
} | ||
|
||
static thread_task_func_t _handlers[] = { t1, t2, t3 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might fit better at the top, next to _names? Or at least the two together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its a tradeoff, having it here means that I was able to skip the forward declaration of the thread functions...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. yep
NB I've differentiated between "review changes" and "suggestions". I.e. between saying, "this should be changed", and just giving feedback, to be changed if desired. Is this clear in the way I've done it? |
b8c7968
to
6d819e6
Compare
fixed style issues, looking into the starvation vs inversion problem next |
changed the test slightly, should now actually test for prio inversion instead of prio starvation, right? In the end IMHO it does not really matter, as both versions break without any counter measures, and both versions are fixed with priority inheritance enabled, so they should actually test for very similar behavior. |
Test for showing priority inversion when using msg_send_receive | ||
|
||
If this tests succeeds, you should see 6 events appearing in order. | ||
The expected output should look like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please change the readme to reflect the recent changes in the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course
e773877
to
7c857e5
Compare
fixed the README and squashed. |
7c857e5
to
6762d07
Compare
fixed board blacklisting and squashed. |
6762d07
to
465f0c7
Compare
fixed one more little pep issue in the testrunner script |
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. |
Since this PR has been stale for several years, I'll convert it to a draft. Please feel free to remove the draft state if anyone wants to pick this up again. |
Contribution description
#7445 also introduces priority inheritance for
msg_send_receive
calls. This PR adds a test showcasing priority inversion formsg_send_receive
, cutting it from #7445 for simpler reviewing...Issues/PRs references
Cut out from #7445 and similar to #7444