DPDK patches and discussions
 help / color / mirror / Atom feed
From: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
To: dev@dpdk.org
Cc: wathsala.vithanage@arm.com, dhruv.tripathi@arm.com, nd@arm.com,
	Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
	stable@dpdk.org, Ola Liljedahl <ola.liljedahl@arm.com>
Subject: [PATCH 1/2] rcu: use atomic operation on acked token
Date: Mon,  5 Feb 2024 04:59:48 +0000	[thread overview]
Message-ID: <20240205045949.1085128-1-honnappa.nagarahalli@arm.com> (raw)

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


             reply	other threads:[~2024-02-05  5:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05  4:59 Honnappa Nagarahalli [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240205045949.1085128-1-honnappa.nagarahalli@arm.com \
    --to=honnappa.nagarahalli@arm.com \
    --cc=dev@dpdk.org \
    --cc=dhruv.tripathi@arm.com \
    --cc=nd@arm.com \
    --cc=ola.liljedahl@arm.com \
    --cc=stable@dpdk.org \
    --cc=wathsala.vithanage@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).