This is not a read-write lock.
The user field stores the thread ID, not the core ID
since a change in DPDK 2.0.0.
The implementation is architecture-specific in some cases only.
Fixes: ca2e2dab079a ("spinlock: support non-EAL thread")
Fixes: af75078fece3 ("first public release")
Cc: [email protected]
Reported-by: Stephen Hemminger <[email protected]>
Signed-off-by: Thomas Monjalon <[email protected]>
---
lib/eal/include/generic/rte_spinlock.h | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/lib/eal/include/generic/rte_spinlock.h
b/lib/eal/include/generic/rte_spinlock.h
index e7cd18a8e2..dd3d2d046c 100644
--- a/lib/eal/include/generic/rte_spinlock.h
+++ b/lib/eal/include/generic/rte_spinlock.h
@@ -7,12 +7,16 @@
/**
* @file
+ * DPDK spinlocks
*
- * RTE Spinlocks
+ * This is an API for spinlocks.
+ * This kind of lock simply waits in a loop
+ * repeatedly checking until the lock becomes available.
*
- * This file defines an API for read-write locks, which are implemented
- * in an architecture-specific way. This kind of lock simply waits in
- * a loop repeatedly checking until the lock becomes available.
+ * Some functions may have an architecture-specific implementation
+ * if RTE_FORCE_INTRINSICS is disabled.
+ * The hardware transactional memory (lock elision) functions have _tm suffix
+ * and are implemented in architecture-specific files.
*
* All locks must be initialised before use, and only initialised once.
*/
@@ -198,7 +202,7 @@ rte_spinlock_trylock_tm(rte_spinlock_t *sl)
*/
typedef struct {
rte_spinlock_t sl; /**< the actual spinlock */
- RTE_ATOMIC(int) owner; /**< core id using lock, -1 for unused */
+ RTE_ATOMIC(int) owner; /**< thread id owning lock, -1 for unused */
int count; /**< count of time this lock has been called */
} rte_spinlock_recursive_t;
--
2.54.0