jimmystewpot commented on PR #3752:
URL: https://github.com/apache/brpc/pull/3752#issuecomment-7061740844

   Hey @chenBright, really sorry about missing those — good catch on all three, 
and thanks heaps for taking the time to dig into them! I've pushed two 
follow-up commits to sort everything out:
   
   1. **`Release_CompareAndSwap` failure-path ordering (`771d2643`):** My bad 
for dropping the pre-CAS barrier on failure. I reproduced the store-buffering 
reordering with a Dekker test on ARMv8.0-A LL/SC, then added 
`__atomic_thread_fence(__ATOMIC_SEQ_CST)` before 
`__atomic_compare_exchange_n(..., __ATOMIC_RELEASE, __ATOMIC_RELAXED)` in both 
the 32-bit and 64-bit overloads (keeping `__ATOMIC_RELEASE` on success so Clang 
TSan still tracks the synchronisation edge), along with 
`AtomicOpsTest.ReleaseCompareAndSwapFailureOrdering` as a regression test.
   2. **TSan race on `Acquire_Store(&turn, 0)` & `Release_CompareAndSwap` 
visibility coverage (`9a34694b`):** Apologies for not catching the TSan race 
earlier — reproduced it straight away under Clang TSan. Replaced 
`Acquire_Store(&turn, 0)` on even consumer rounds with 
`Release_CompareAndSwap(&turn, 1, 0)` and alternated 
`Release_CompareAndSwap(&turn, 0, 1)` / `Release_Store(&turn, 1)` on the 
producer side so both operations are properly verified for non-atomic payload 
visibility.
   
   Re-tested on ARM64 across Clang (LL/SC, LSE, ASan+UBSan, standalone UBSan, 
TSan with `halt_on_error=1`), GCC 14/15 (`-march=armv8-a`, `-march=armv8.1-a`, 
`-moutline-atomics`), and `test_butil` — all green now. Thanks again for the 
thorough review, really appreciate it!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to