summaryrefslogtreecommitdiff
path: root/common_modules/module_lib
diff options
context:
space:
mode:
authorFrédéric Desbiens <[email protected]>2026-09-28 12:43:42 -0400
committerGitHub <[email protected]>2026-09-28 12:43:42 -0400
commit2886bdff6fe502a9e1a64d46856a2e9433da33f9 (patch)
tree99203d293daa456dd33c23a80fa39bd3f68270a6 /common_modules/module_lib
parente3ed79dbab40396ea037aa2f68a5fbdcd6314e2e (diff)
Stopped the SMP Linux port leaking a critical section on unprotect (#759)
_tx_thread_smp_unprotect takes the Linux mutex on entry and releases it twice when the protection structure names this core, but only once when it does not, while the matching _tx_thread_smp_protect took it once either way. _tx_thread_system_return clears the protection outright, so an unprotect can find it no longer naming its core and return having released one level fewer than were taken. A thread that later reaches _tx_linux_mutex_release_all drains that level. The timer interrupt thread has none on its tick path unless a thread was preempted on core 0, so a level leaked there while core 0 is idle is never recovered: the nesting count never reaches zero, the mutex is never handed back to Linux, and every other thread waits on it for the life of the process while the tick keeps arriving. The release of the level the matching protect took now happens whether or not the protection still names this core. Protection bookkeeping and scheduling are unchanged, and releasing beyond what a thread holds was already a no-op. Two hung processes captured untraced, in different tests, show the timer thread owning the mutex with a nesting count of one while parked in its tick wait, the scheduler blocked in pthread_mutex_timedlock, and the clock advancing 99 ticks a second across a ten second sample while nothing else changes. On a healthy run that path is taken 0 times in 26,546 unprotect calls. Forcing it on the timer thread leaks one level before this change and balances after it. Assisted-by: Claude Code (Opus 5) <[email protected]>
Diffstat (limited to 'common_modules/module_lib')
0 files changed, 0 insertions, 0 deletions