From patchwork Mon Feb 5 04:59:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 136378 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DAAD543A70; Mon, 5 Feb 2024 06:00:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 635F4402BE; Mon, 5 Feb 2024 06:00:25 +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 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-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);