-
Notifications
You must be signed in to change notification settings - Fork 3k
Add thread terminate hook #4684
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
Conversation
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.
Thanks for the fix
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.
The event recorder changes seem to be an addition not needed for the fix. If we're going to use the event recorder that should come in an additional PR or commit (if an extension of how its already used).
rtos/rtx5/mbed_rtx_handlers.c
Outdated
#endif | ||
} | ||
|
||
void EvrRtxThreadTerminate (osThreadId_t thread_id) { |
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.
{
on the new line for both functions as the rest of functions in this file
@sg- the event recorder stuff is to keep the RTOS behavior the same. It's not an addition. The functions EvrRtxThreadExit and EvrRtxThreadTerminate in this PR override weak the weak versions in rtx_evr.c. If the event logic isn't the same in these overridden functions, then RTX 5 event reporting will no longer work correctly in Keil. |
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.
LGTM
OK thanks for the clarification. I had searched for that but failed from the trailing |
@sg- : I added trailing _ to avoid re-definition and to know what was updated in RTX5 in case of future RTX changes. Do we have some standard mechanism to keep track of such changes (over-write behavior of RTX5), so that we do not miss them in future merges? |
So why are we defining it if it causes redefinition? Can't we just use the RTX defined events? We have some CMSIS/RTX documentation here including changes to RTX, adding section that documents what's we overload in |
@deepikabhavnani Bump. You may want to have a chat with @bulislaw offline to get clarification of what needs to be done. |
2c34d16
to
cd65c34
Compare
@RobertRostohar @JonatanAntoni is there any reason why all the event ids are defined in .c file? https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/RTOS2/RTX/Source/rtx_evr.c all the functions are |
Bump. @bulislaw @deepikabhavnani Any news? |
@JonatanAntoni can you look at the question above? |
As per @JonatanAntoni: over writing event handlers is not correct way to fix this issue. PR is required to enhance RTX thread with an official exit hook. |
@sg- @bulislaw @deepikabhavnani any news? |
What issues does it cause? If it's an actual problem I'll say lets bring it in now, if it's an improvement/good to have it'll probably be better to wait till it's fixed in RTX. |
@bulislaw - Thread terminate hook is to record stack/heap related information during CI, we will not get details of threads which were terminated due to some issues. It won;t stall anything only will make debugging difficult in case of issues. |
@deepikabhavnani Could you rebase to resolve the conflicts? |
cd65c34
to
a6cce99
Compare
@deepikabhavnani This info could be part of the commit msg to provide useful info why its being added.
Is there an issue for this? I don't see it referenced here anywhere.
I am fine with this as the fix to bring the old behavior back as it was useful and being used (in the tests mentioned above). Once RTX gets an update, we will replace this with a proper fix. If someone has a strong no for this, speak now. |
a6cce99
to
5ec41e1
Compare
Rebased to resolve conflicts and updated commit message |
If everyone is ok with this solution shall we merge it? After CI :-) |
I created ARM-software/CMSIS_5#245 to track this with the RTX team. |
/morph test |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputTest failed! |
Hook was added in RTX4 code to assist test framework to log thread info on thread terminate, which was not working with RTX5.
5ec41e1
to
a2b5301
Compare
3 test were skipped for all targets, not sure why :-(
Rebased and verified K64F on local setup |
/morph test |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputTest failed! |
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Description
Hook was added in RTX4 code to assist test framework to log thread info on thread terminate, which was not working with RTX5.
Status
READY
Steps to test or reproduce
Execute test mbed-os-tests-mbedmicro-rtos-mbed-threads with MBED_STACK_STATS_ENABLED set to 1.
@c1728p9 @bulislaw