fix: use inherited priority for event item value in vTaskPrioritySet#1380
Open
Harsha-s210313 wants to merge 1 commit intoFreeRTOS:mainfrom
Open
fix: use inherited priority for event item value in vTaskPrioritySet#1380Harsha-s210313 wants to merge 1 commit intoFreeRTOS:mainfrom
Harsha-s210313 wants to merge 1 commit intoFreeRTOS:mainfrom
Conversation
When a task holds a mutex and has an inherited priority, the event list item value should reflect the effective priority (pxTCB->uxPriority) rather than the requested new priority (uxNewPriority). Using uxNewPriority can result in incorrect ordering in the event waiting list, leading to deadlock when a task tries to acquire multiple mutexes. Fixes FreeRTOS#1364
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #1364
Problem
When
vTaskPrioritySet()is called on a task that holds a mutex and hasan inherited priority, the event list item value is set using
uxNewPriority(the requested new priority) instead of
pxTCB->uxPriority(the effectivecurrent priority after inheritance).
This incorrect ordering in the event waiting list can cause the task to
never be unblocked when attempting to acquire additional mutexes, leading
to deadlock.
Fix
Replace
uxNewPrioritywithpxTCB->uxPrioritywhen setting the eventlist item value, consistent with how
xTaskPriorityInherit()andvTaskPriorityDisinheritAfterTimeout()handle this.Testing
Reproducer and test case provided by the original reporter at:
https://github.com/wirelinker/FreeRTOS_kernel_test_for_RP2040/tree/vTaskPrioritySet_event_item_value_deadlock_test