DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] rcu: use atomic operation on acked token
@ 2024-02-05  4:59 Honnappa Nagarahalli
  2024-02-05  4:59 ` [PATCH 2/2] rcu: use correct value of acked token in debug print Honnappa Nagarahalli
  0 siblings, 1 reply; 3+ messages in thread
From: Honnappa Nagarahalli @ 2024-02-05  4:59 UTC (permalink / raw)
  To: dev
  Cc: wathsala.vithanage, dhruv.tripathi, nd, Honnappa Nagarahalli,
	stable, Ola Liljedahl

acked_token should be read using atomic operation as the
the API rte_rcu_qsbr_check is advertised as multi-thread safe.

Fixes: 1f90d32ce175 ("rcu: add least acknowledged token optimization")
Cc: stable@dpdk.org

Reported-by: Ola Liljedahl <ola.liljedahl@arm.com>
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
---
 lib/rcu/rte_rcu_qsbr.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/rcu/rte_rcu_qsbr.h b/lib/rcu/rte_rcu_qsbr.h
index 5979fb0efb..f6a3731308 100644
--- a/lib/rcu/rte_rcu_qsbr.h
+++ b/lib/rcu/rte_rcu_qsbr.h
@@ -667,7 +667,8 @@ rte_rcu_qsbr_check(struct rte_rcu_qsbr *v, uint64_t t, bool wait)
 	RTE_ASSERT(v != NULL);
 
 	/* Check if all the readers have already acknowledged this token */
-	if (likely(t <= v->acked_token)) {
+	if (likely(t <= rte_atomic_load_explicit(&v->acked_token,
+						rte_memory_order_relaxed))) {
 		__RTE_RCU_DP_LOG(DEBUG,
 			"%s: check: token = %" PRIu64 ", wait = %d",
 			__func__, t, wait);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] rcu: use correct value of acked token in debug print
  2024-02-05  4:59 [PATCH 1/2] rcu: use atomic operation on acked token Honnappa Nagarahalli
@ 2024-02-05  4:59 ` Honnappa Nagarahalli
  2024-02-18 18:13   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Honnappa Nagarahalli @ 2024-02-05  4:59 UTC (permalink / raw)
  To: dev
  Cc: wathsala.vithanage, dhruv.tripathi, nd, Honnappa Nagarahalli,
	stable, Nathan Brown

Debug print should use acked token value that was used for comparison.

Fixes: bf386ae377aa ("rcu: add additional debug logs")
Cc: stable@dpdk.org

Reported-by: Nathan Brown <nathan.brown@arm.com>
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Nathan Brown <nathan.brown@arm.com>
---
 lib/rcu/rte_rcu_qsbr.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/rcu/rte_rcu_qsbr.h b/lib/rcu/rte_rcu_qsbr.h
index f6a3731308..a7d6e63560 100644
--- a/lib/rcu/rte_rcu_qsbr.h
+++ b/lib/rcu/rte_rcu_qsbr.h
@@ -664,17 +664,20 @@ __rte_rcu_qsbr_check_all(struct rte_rcu_qsbr *v, uint64_t t, bool wait)
 static __rte_always_inline int
 rte_rcu_qsbr_check(struct rte_rcu_qsbr *v, uint64_t t, bool wait)
 {
+	uint64_t acked_token;
+
 	RTE_ASSERT(v != NULL);
 
 	/* Check if all the readers have already acknowledged this token */
-	if (likely(t <= rte_atomic_load_explicit(&v->acked_token,
-						rte_memory_order_relaxed))) {
+	acked_token = rte_atomic_load_explicit(&v->acked_token,
+						rte_memory_order_relaxed);
+	if (likely(t <= acked_token)) {
 		__RTE_RCU_DP_LOG(DEBUG,
 			"%s: check: token = %" PRIu64 ", wait = %d",
 			__func__, t, wait);
 		__RTE_RCU_DP_LOG(DEBUG,
 			"%s: status: least acked token = %" PRIu64,
-			__func__, v->acked_token);
+			__func__, acked_token);
 		return 1;
 	}
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] rcu: use correct value of acked token in debug print
  2024-02-05  4:59 ` [PATCH 2/2] rcu: use correct value of acked token in debug print Honnappa Nagarahalli
@ 2024-02-18 18:13   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2024-02-18 18:13 UTC (permalink / raw)
  To: Honnappa Nagarahalli, Nathan Brown
  Cc: dev, stable, wathsala.vithanage, dhruv.tripathi, nd

05/02/2024 05:59, Honnappa Nagarahalli:
> Debug print should use acked token value that was used for comparison.
> 
> Fixes: bf386ae377aa ("rcu: add additional debug logs")
> Cc: stable@dpdk.org
> 
> Reported-by: Nathan Brown <nathan.brown@arm.com>
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Nathan Brown <nathan.brown@arm.com>

We trust you about RCU :)

Series applied, thanks.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-18 18:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-05  4:59 [PATCH 1/2] rcu: use atomic operation on acked token Honnappa Nagarahalli
2024-02-05  4:59 ` [PATCH 2/2] rcu: use correct value of acked token in debug print Honnappa Nagarahalli
2024-02-18 18:13   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).