summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuifeng Wang <ruifeng.wang@arm.com>2019-09-09 21:51:42 +0800
committerDavid Marchand <david.marchand@redhat.com>2019-10-18 06:13:36 +0200
commitb36f587f010bba421a8fd0b4c383276ecb796ae3 (patch)
treeb9dc3b5f2faf69d805a61158c9785fef27c9045a
parente484ccddbe1b41886fef1e445ef2fdfa55086198 (diff)
downloaddpdk-next-eventdev-b36f587f010bba421a8fd0b4c383276ecb796ae3.zip
dpdk-next-eventdev-b36f587f010bba421a8fd0b4c383276ecb796ae3.tar.gz
dpdk-next-eventdev-b36f587f010bba421a8fd0b4c383276ecb796ae3.tar.xz
rcu: fix spurious thread unregister
Thread unregister returns success while unregister not been performed. This is due to incorrect thread registration status check. Fix this issue by correcting bitmap check. Fixes: 64994b56cfd7 ("rcu: add RCU library supporting QSBR mechanism") Cc: stable@dpdk.org Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com> Reviewed-by: Gavin Hu <gavin.hu@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: David Marchand <david.marchand@redhat.com>
-rw-r--r--lib/librte_rcu/rte_rcu_qsbr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/librte_rcu/rte_rcu_qsbr.c b/lib/librte_rcu/rte_rcu_qsbr.c
index a6b66ac..474675d 100644
--- a/lib/librte_rcu/rte_rcu_qsbr.c
+++ b/lib/librte_rcu/rte_rcu_qsbr.c
@@ -157,7 +157,7 @@ rte_rcu_qsbr_thread_unregister(struct rte_rcu_qsbr *v, unsigned int thread_id)
/* Check if the thread is already unregistered */
old_bmap = __atomic_load_n(__RTE_QSBR_THRID_ARRAY_ELM(v, i),
__ATOMIC_RELAXED);
- if (old_bmap & ~(1UL << id))
+ if (!(old_bmap & (1UL << id)))
return 0;
do {
@@ -174,7 +174,7 @@ rte_rcu_qsbr_thread_unregister(struct rte_rcu_qsbr *v, unsigned int thread_id)
if (success)
__atomic_fetch_sub(&v->num_threads,
1, __ATOMIC_RELAXED);
- else if (old_bmap & ~(1UL << id))
+ else if (!(old_bmap & (1UL << id)))
/* Someone else unregistered this thread.
* Counter should not be incremented.
*/