-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
FreeRTOS: add mutex hold count to task status info (IDFGH-3762) #5682
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for your contribution. |
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.
@dexterbg , thanks for your contribution, Mutex debug utilities are always welcome :)
I just left a small minor comment, otherwise, LGTM.
@@ -181,6 +181,7 @@ typedef struct xTASK_STATUS | |||
eTaskState eCurrentState; /*!< The state in which the task existed when the structure was populated. */ | |||
UBaseType_t uxCurrentPriority; /*!< The priority at which the task was running (may be inherited) when the structure was populated. */ | |||
UBaseType_t uxBasePriority; /*!< The priority to which the task will return if the task's current priority has been inherited to avoid unbounded priority inversion when obtaining a mutex. Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */ | |||
UBaseType_t uxMutexesHeld; /*!< The number of mutexes currently held by the task. Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */ |
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.
@dexterbg , could you please put this field around a configUSE_MUTEXES ifdef? Since this is more a debug feature, release applications may not use it, and it could be good to save more memory as possible on the TCBs.
@uLipe I would already have done so, if |
@dexterbg , the |
@uLipe Take a look at the TCB definition: There is no |
@dexterbg , I was also afraid this was left behind to its usage by espcoredump component (which currently has very strict rules about data structure size and depends on freertos tasks). After looking better, the implementation, leaving both fields without #ifdef will keep the freertos code close of the upstream version, so please just ignore my suggestion. Thanks again for your contribution |
This change enables applications to track down and debug stuck mutex priority inheritance and missing mutex release issues.
If
uxCurrentPriority
!=uxBasePriority
anduxMutexesHeld
> 0, the task has taken a mutex which was then required by a higher priority task. That's normal FreeRTOS mutex priority inheritance, but should only occur temporarily. IfuxMutexesHeld
continues rising, the application has a bug in mutex management.