proc/threads: preserve priority inheritance for SMP#803
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the lock acquisition loop in _proc_lockSet within proc/threads.c. It replaces the do-while loop and the call to proc_threadWaitEx with an infinite for loop that manually handles thread enqueuing, spinlock clearing/setting, and CPU rescheduling. It also adjusts the interruptible exit checks and spinlock management. There are no review comments, and I have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Unit Test Results9 821 tests - 1 039 9 216 ✅ - 974 46m 52s ⏱️ - 6m 11s Results for commit 141514c. ± Comparison against base commit 11a35ff. This pull request removes 1039 tests.♻️ This comment has been updated with latest results. |
TASK: RTOS-1374
70e1736 to
141514c
Compare
Description
Potential priority inheritance race can occur on SMP when contender bumps owner priority while waiting for a lock, but owner releases another lock, before contender was added to lock waiting queue.
This solution just rips
proc_threadWaitEx()so thread_common spinlock is not released before contender is added to lock waiting queue. Without some priority inheritance structures (like tree) this is the smallest amount of fixing source code I could come up with, although not very elegant. Feel free to share another ideas.Motivation and Context
Fixes phoenix-rtos/phoenix-rtos-project#1626
Types of changes
How Has This Been Tested?
Checklist:
Special treatment