From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5BFE9A04C0; Fri, 25 Sep 2020 19:44:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 730591E9D9; Fri, 25 Sep 2020 19:44:15 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 445C41E9D0 for ; Fri, 25 Sep 2020 19:44:10 +0200 (CEST) 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 B2069101E; Fri, 25 Sep 2020 10:44:08 -0700 (PDT) Received: from localhost.localdomain (unknown [10.57.54.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 02B443F718; Fri, 25 Sep 2020 10:44:07 -0700 (PDT) From: Steven Lariau To: Gage Eads , Olivier Matz Cc: dev@dpdk.org, nd@arm.com, Steven Lariau Date: Fri, 25 Sep 2020 18:43:35 +0100 Message-Id: <20200925174340.10014-2-steven.lariau@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200925174340.10014-1-steven.lariau@arm.com> References: <20200911152938.8019-1-steven.lariau@arm.com> <20200925174340.10014-1-steven.lariau@arm.com> Subject: [dpdk-dev] [PATCH v2 1/5] lib/stack: fix inconsistent weak / strong cas X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Fix cmpexchange usage of weak / strong. The generated code is the same on x86 and ARM (there is no weak cmpexchange), but the old usage was inconsistent. For push and pop update size, weak is used because cmpexchange is inside a loop. For pop update root, strong is used even though cmpexchange is inside a loop, because there may be a lot of operations to do in a loop iteration (locate the new head). Signed-off-by: Steven Lariau Reviewed-by: Dharmik Thakkar Reviewed-by: Ruifeng Wang Acked-by: Gage Eads --- lib/librte_stack/rte_stack_lf_c11.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_stack/rte_stack_lf_c11.h b/lib/librte_stack/rte_stack_lf_c11.h index 999359f08..1e0ea0bef 100644 --- a/lib/librte_stack/rte_stack_lf_c11.h +++ b/lib/librte_stack/rte_stack_lf_c11.h @@ -96,7 +96,7 @@ __rte_stack_lf_pop_elems(struct rte_stack_lf_list *list, /* len is updated on failure */ if (__atomic_compare_exchange_n(&list->len, &len, len - num, - 0, __ATOMIC_ACQUIRE, + 1, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE)) break; } @@ -149,7 +149,7 @@ __rte_stack_lf_pop_elems(struct rte_stack_lf_list *list, (rte_int128_t *)&list->head, (rte_int128_t *)&old_head, (rte_int128_t *)&new_head, - 1, __ATOMIC_RELEASE, + 0, __ATOMIC_RELEASE, __ATOMIC_RELAXED); } while (success == 0); -- 2.17.1