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 8320BA04BB; Fri, 11 Sep 2020 17:31:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EFF1B1C112; Fri, 11 Sep 2020 17:31:31 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 6DA801C113 for ; Fri, 11 Sep 2020 17:31:30 +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 EC34B147A; Fri, 11 Sep 2020 08:31:29 -0700 (PDT) Received: from localhost.localdomain (unknown [10.57.10.210]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6E1333F73C; Fri, 11 Sep 2020 08:31:28 -0700 (PDT) From: Steven Lariau To: Gage Eads , Olivier Matz Cc: dev@dpdk.org, nd@arm.com, dharmik.thakkar@arm.com, Steven Lariau Date: Fri, 11 Sep 2020 16:29:37 +0100 Message-Id: <20200911152938.8019-5-steven.lariau@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200911152938.8019-1-steven.lariau@arm.com> References: <20200911152938.8019-1-steven.lariau@arm.com> Subject: [dpdk-dev] [PATCH 4/5] lib/stack: reload head when pop fails 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" List head must be loaded right before continue (when failed to find the new head). Without this, one thread might keep trying and failing to pop items without ever loading the new correct head. Signed-off-by: Steven Lariau Reviewed-by: Dharmik Thakkar Reviewed-by: Ruifeng Wang --- lib/librte_stack/rte_stack_lf_c11.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_stack/rte_stack_lf_c11.h b/lib/librte_stack/rte_stack_lf_c11.h index 2bc639419..adb9f590d 100644 --- a/lib/librte_stack/rte_stack_lf_c11.h +++ b/lib/librte_stack/rte_stack_lf_c11.h @@ -133,8 +133,10 @@ __rte_stack_lf_pop_elems(struct rte_stack_lf_list *list, /* If NULL was encountered, the list was modified while * traversing it. Retry. */ - if (i != num) + if (i != num) { + old_head = list->head; continue; + } new_head.top = tmp; new_head.cnt = old_head.cnt + 1; -- 2.17.1