From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AAF0643A71 for ; Mon, 5 Feb 2024 06:00:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A0FD402EF; Mon, 5 Feb 2024 06:00:26 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 5485D400D6; Mon, 5 Feb 2024 06:00:24 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EAC941FB; Sun, 4 Feb 2024 21:01:05 -0800 (PST) Received: from ampere-altra-2-1.usa.Arm.com (ampere-altra-2-1.usa.arm.com [10.118.91.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 796533F5A1; Sun, 4 Feb 2024 21:00:23 -0800 (PST) From: Honnappa Nagarahalli To: dev@dpdk.org Cc: wathsala.vithanage@arm.com, dhruv.tripathi@arm.com, nd@arm.com, Honnappa Nagarahalli , stable@dpdk.org, Ola Liljedahl Subject: [PATCH 1/2] rcu: use atomic operation on acked token Date: Mon, 5 Feb 2024 04:59:48 +0000 Message-Id: <20240205045949.1085128-1-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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 Signed-off-by: Honnappa Nagarahalli Reviewed-by: Ola Liljedahl --- 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