You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Address a Clang/LLVM sanitizer warning that scp_asynch_check is written
by both the AIO and main threads, one thread potentially clobbering the
other's value.
The "scp_asynch_check = 0" at scp.c:239 is where the thread sanitizer
detects the issue. This assignment is supposed to cause the main thread
to process I/O updates on the next AIO_CHECK_EVENT code's execution. To
preserve that behavior, AIO_CHECK_EVENT now executes AIO_UPDATE_QUEUE
when sim_asynch_queue != QUEUE_HEAD, i.e., there is work to be done in
the queue.
Code refactoring:
- Convert preprocessor macro code to inline functions unless
impractical.
- Eliminate the asymmetry between the lock-based (mutex) and lock-free
implementations.
- Lock-free: AIO_ILOCK/AIO_IUNLOCK do not reacquire sim_asynch_lock
when compiler intrinsics are detected (GCC, Clang, MS C and DEC C on
Itanium.)
- Lock-based: If DONT_USE_AIO_INTRINSICS is defined or intrinsics are
not detected, the AIO implementation becomes lock-based via mutexes
and AIO_ILOCK/AIO_IUNLOCK recursively acquire/release sim_asynch_lock.
- AIO defaults to the lock-based implementation if compiler intrinsics
are not detected.
- GCC, Clang: Prefer the __atomic intrinsics over the deprecated
__sync intrinsics. The __sync intrinics still exist for older GCC
compilers.
- sim_asynch_lock is a recursive mutex for both lock-based and
lock-free implementations. Eliminates implementation asymmetry.
- AIO_CHECK_EVENT invokes AIO_ILOCK and AIO_IUNLOCK so that the lock-based
code cannot alter sim_asynch_queue when checking for pending I/O work.
- sim_debug_io_lock: Debug output serialization lock. sim_asynch_lock
was semantically overloaded to serialize output from
_sim_debug_write_flush. This lock provides better semantic clarity.
- Removed sim_asynch_check. It is no longer necessary.
- New builder script flag to disable AIO lock-free, force AIO lock-based code:
- cmake-builder.ps1 -noaiointrinsics ...
- cmake-builder.sh -no-aio-intrinics ...
"-DDONT_USE_AIO_INTRINSICS:Bool=On" is the command line CMake
configuration option.
0 commit comments