Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 613bee0af5:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_pthread_mutex_spin_testsbuilt cleanly. - CTest (
guest_pthread_mutex_spin):1/1 Test #6453: guest_pthread_mutex_spin ......... Passed 3.06 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libkernel/Pthread/include/Mutex.hppreverted tomainand the new tests kept, the suite fails:Restoring the change makes it pass again.1/1 Test #6453: guest_pthread_mutex_spin .........Subprocess aborted***Exception: 0.34 sec 0% tests passed, 1 tests failed out of 1 - Code reading:
- Verified core/libs/prx/libkernel/Pthread/include/Mutex.hpp: SpinAcquire correctly executes pause() before tryAcquire() on each iteration of the spin loop, matching the yield loop semantics and preventing immediate retry with no pause.
- Verified loop bounds and termination conditions: non-positive spins/yields (spins <= 0, yields <= 0) correctly bypass the loops after the initial tryAcquire() without underflow or unexpected behavior.
- Verified template parameter safety and lambda invocations (TTry, TPause, TYield) for value/reference forwarding, side-effects, and exception neutrality.
- Verified core/libs/tests/GuestPthreadMutexSpin.cpp test coverage, including updated pause counts, negative controls, zero/negative bounds, and explicit event trace sequencing ('T,P,T,P,T,Y,T').
- Verified strict AGENTS.md conventions: no illegal comments added, no technical debt discrepancies, no stubbing violations, and PR description template compliance.
Looks Good To Me
|
Windows at this head ( Setup:
The added test lines have no platform guard. AI-assisted: yes. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The code change moves each spin pause before its retry, and the updated regression cases cover the changed ordering and bounds at head 613bee0af5615d2c7feea4744c1775e389e80fd6.
What I ran
Read the prepared diff and changed source at the pinned head. No commands or tests were run; the test outcomes in the description are author-reported.
Results
| Check | Result | Note |
|---|---|---|
| Changed-line review | passed | Both changed files read |
| Runtime tests | not run | Description reports test results |
Findings
Blocking
None.
Non-blocking
None.
Not verified
No test suite, build, or console behavior was run. No files were excluded by manifest.json; both reviewed files were read: core/libs/prx/libkernel/Pthread/include/Mutex.hpp and core/libs/tests/GuestPthreadMutexSpin.cpp. Mutex.cpp and Cond.cpp were read for caller context.
To get this to a good state
Nothing is required.
Plyxen
left a comment
There was a problem hiding this comment.
Checked head 613bee0af5. All on Windows 11 with WinLibs GCC 15.2 (Release), applied to main a163d4b886 together with #27930, #27929, #27926, #27925, #27924, #27923, #27901, #27828, #27771, #27755, #27748, #27682, #27765. tools/check_conventions.py --head and tools/debt_fold.py --check passed and the full build succeeded. guest_pthread_mutex_spin passes. guest_pthread_mutex_contention timed out in the loaded suite, as it does on main. Run on its own, it takes the same time with and without this change. In the full CPU suite (5,120 tests) the only failures are unrelated:
windows_read_trap_unknownfails onmaintoo (fixed in #28028).frame_capture_minimize,jpeg_external_toolchainandguest_pthread_mutex_contentionare timeouts under load; they pass when run on their own.guest_audio_in_capturepasses 20/20 onmainand with this change.
AI-assisted: yes (Claude Code)
ligmaSec
left a comment
There was a problem hiding this comment.
The Linux guest_pthread_mutex_spin CTest passed with the patch. Its instrumented retry loop checks that pauses and yields occur before the next retry, including when a phase has no retries, and checks eventual acquisition.
AI-assisted: yes.
What
MutexOperations::SpinAcquire(core/libs/prx/libkernel/Pthread/include/Mutex.hpp) so each iteration of the spin loop callspause()before retryingif (tryAcquire()) return true;, matching theyield()loop directly below it.tryAcquire()immediately after the initialtryAcquire()check and exited after the finalpause()without retrying, causing a back-to-back retry with no pause and missing unlocks occurring during the last spin pause.libkernel):MutexOperations::SpinAcquireis used by contended guest pthread mutex and condvar lock acquisitions.Tested
guest_pthread_mutex_spin(CheckSpinAcquireincore/libs/tests/GuestPthreadMutexSpin.cpp):Spin(5, 3, 4, counts)expectation frompauses == 2topauses == 3(tries == 4, yields == 0), matching pause-before-retry; fails onmain(pauses == 2) and passes with this fix.spins = 1, yields = 0) wheretryAcquire()returnstrueonly afterpause()runs once (acquired == true,paused == true,tries == 2,yields == 0), failing onmainand passing with this fix.spins = 2, yields = 1) verifying the exact sequence"T,P,T,P,T,Y,T".spins = 0, yields = 0andspins = -3, yields = -1) verifying a singletryAcquire()(tries == 1) with zero pauses or yields.Checklist
main; no other open PR implements the same functionstools/check_conventions.pypasses)NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repositorymainand passes after fixSummary by CodeRabbit