This introduces an enhanced spinlock that adds safeguards compared to the default pthread_spinlock_t. In particular: - A pthread_spinlock_t is still used, but additional error checking is performed to ensure there is no undefined behavior on relock, unlocking when not the owner, or destoying a locked lock. - The SPDK concurrency model allows an SPDK thread to be migrated between pthreads. Releasing a pthread spinlock on a different thread from where it is taken is undefined behavior. If an SPDK spinlock is held at a time that a time when a poller or message returns control to thread_poll(), the program will abort. - SPDK spinlocks can only be obtained from an SPDK thread. Signed-off-by: Mike Gerdts <mgerdts@nvidia.com> Change-Id: I6dd6493ab5f5532ae69e20654546405a507eb594 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15277 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Community-CI: Mellanox Build Bot |
||
---|---|---|
.. | ||
Makefile | ||
thread_ut.c |