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 B81EBA0C47 for ; Thu, 19 Aug 2021 11:39:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A7A6E4120C; Thu, 19 Aug 2021 11:39:54 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60111.outbound.protection.outlook.com [40.107.6.111]) by mails.dpdk.org (Postfix) with ESMTP id 54BF840141; Thu, 19 Aug 2021 11:39:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mefui7Fpu516ZT/kHlTIouXCxHOFJJMfkW8w8IO2ExgpU6G5dhVDsHxyUZUAe4wpeVa3MbYX49cROHEItsjqs/nhFHAKhjpk+FHvZJgc5+g7V+5BXePmT8szP6FVRkLANJjdYJw6mXKK5C+tiBjCP8jWGWJCKCMIn2pUQpxZ+RQIy/4JmFAiU389xmI40quNGie3rs8PBZTVBd9iiB3xdASD2dTZcTh26irTq8iBCrHsj8yFCmvW4+NsEGmC39I1Rgf3ZciMacFOQ+eW8uu+xcF9xjlvvqMqcVx4TTy+cXGRBWJx32B3TrSNkqLruyHABNIKHYyXirD9rjqy6dHDwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EKLG/C3mMhkqVtSMrRBNqiMvVahtLBftTs3HlENkGaM=; b=I4OeIf94mV4QqafUqpXSIeE0Ft6TzzLozXEVLN3JqTAqSy7YnmHw4Pohd82113hGECB1kR5O+z89eXeOrPSJRG2+ayuY2EkI0oodt8HUVua/9wzvY5DJgsSfx6KnJNjINVCHNnsP9cRPXNcet5qdFe2SuYF74CV91zwL2iOC4h4id2WzDRN4mC9AjHrDJkTGwF/2O0PyMVW3Hypvsqa36IPXrev6b5NJrQXF7H9fKln1GTtj1HSmhQuKzgQFu7Ij7uXmqfqrkbVb92UiEykWkZquKMG9keqt91bPLJU7Tdm1lLcMciTfbGbvqwBVpdY5RXfn3WJGM/Ivi6HJmvogUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 131.228.6.100) smtp.rcpttodomain=6wind.com smtp.mailfrom=nokia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nokia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EKLG/C3mMhkqVtSMrRBNqiMvVahtLBftTs3HlENkGaM=; b=ncsrkpNfXZzHHrQsxrXarlveIdzhzjhtOzQIBSwh1rBaKwLLl03vfOyHcQnnnOVf1D4RQWKHzyvTezyq2DawGlItQI+QSNUKFDTqZKNs1AGIzXVLimrZYO74W78/YtjCyTnwWvhCmEUVT6vdPYOn/kkaHQRn1zhav3XzF+Dduk0= Received: from AM6P192CA0043.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:82::20) by VI1PR07MB4079.eurprd07.prod.outlook.com (2603:10a6:803:2c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.12; Thu, 19 Aug 2021 09:39:50 +0000 Received: from VE1EUR03FT053.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:82:cafe::6b) by AM6P192CA0043.outlook.office365.com (2603:10a6:209:82::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Thu, 19 Aug 2021 09:39:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 131.228.6.100) smtp.mailfrom=nokia.com; 6wind.com; dkim=none (message not signed) header.d=none;6wind.com; dmarc=pass action=none header.from=nokia.com; Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.6.100 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.6.100; helo=fr711usmtp2.zeu.alcatel-lucent.com; Received: from fr711usmtp2.zeu.alcatel-lucent.com (131.228.6.100) by VE1EUR03FT053.mail.protection.outlook.com (10.152.19.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Thu, 19 Aug 2021 09:39:50 +0000 Received: from N-20HEPF13R1QL.emea.nsn-net.net (fi-esp-nsnra212112.emea.nsn-net.net [10.144.212.112]) by fr711usmtp2.zeu.alcatel-lucent.com (GMO) with ESMTP id 17J9dn9B008841; Thu, 19 Aug 2021 09:39:49 GMT From: Julien Meunier To: dev@dpdk.org Cc: stable@dpdk.org, gage.eads@intel.com, Olivier Matz Date: Thu, 19 Aug 2021 11:39:14 +0200 Message-Id: <20210819093915.5227-1-julien.meunier@nokia.com> X-Mailer: git-send-email 2.17.1 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: d431d26a-0f6d-410f-b544-08d962f54a6f X-MS-TrafficTypeDiagnostic: VI1PR07MB4079: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1284; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /avG+p2d2Qu6m4SnpaA8iu4fC8chwfptRc2Q+0H5qj/+3w7DYUlofuMhEmjjnjBIyBUjLbLHjbKO/PzagfWolpfufhpAKyVMxsWNhq/Ojf8gVCL7Tu5HFBGSdntXCmtuGatMeFyM1ERb4tGFMjWNs73uikXJsjSazE4v8P5EfM+YN91WPQRB85UOzb3ZbWRq7LET8k4BMxKZTk/zOjMXx8ex5oRbcJuEPnyevmhrO31Cx8Et2gWENjjK7q7Behtu2DlDjeOIWx1Wu1uoWBEOlDiGeRdbM5eq4H09FQkTVKBG+lyMXCLCvTfJpoBN/6PQJrQf5X4KOIy9zI19xeVPbZ10f8+XCRjHC/gpCn7QP0Ssm+5TBntgThsxDFNk59CLAXIY5cNISA2pfMMNTGj+ZqvahMLj9aeg088JxQHiiCwAaTqFgWASOyoeAFEgR4BCi25DUDMJIzTB1W1ak+8e7V481oxmimv4ri23yI3zL1g/06+s754dfZnVDjZD1MlF8mudYqTk6i/cT3AmYS9558Tim3LrQMUjVh8GzQwJYMS/2od8k6cKk5YuSE7A5ZXACBvBmmYIhPQgY9qla8fW3Tfu2O2mCP3haggyv8DQ1FUb8WAy3ACOooos8MZm0XkmQZIjEDm+7CS1SIoo2GiWIv9sobDhB3i5aKuEX4TiaiMgtPaUc9I+68VCuT23QHxxqeb6LEtQnuiu4+Odqk06f0vIeGh58P7LiPSH5X8SjEE+68ox6QuR2eQ7WzIu6kruZSnGCNyMfwgjngnPygEguw== X-Forefront-Antispam-Report: CIP:131.228.6.100; CTRY:FI; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:fr711usmtp2.zeu.alcatel-lucent.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(8936002)(1076003)(81166007)(86362001)(2616005)(36756003)(47076005)(5660300002)(508600001)(6666004)(356005)(6916009)(26005)(83380400001)(186003)(82310400003)(70586007)(8676002)(2906002)(336012)(36860700001)(70206006)(4326008)(44832011)(316002)(41533002)(36900700001); DIR:OUT; SFP:1102; X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2021 09:39:50.4180 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d431d26a-0f6d-410f-b544-08d962f54a6f X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0; Ip=[131.228.6.100]; Helo=[fr711usmtp2.zeu.alcatel-lucent.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT053.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB4079 Subject: [dpdk-stable] [PATCH] stack: reload head when pop fails (generic) 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 Sender: "stable" The previous fix 18effad9cfa7 ("stack: reload head when pop fails") only changed C11 implementation, not generic implementation. 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. Fixes: 3340202f5954 ("stack: add lock-free implementation") Cc: gage.eads@intel.com Cc: stable@dpdk.org Signed-off-by: Julien Meunier --- lib/stack/rte_stack_lf_generic.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/stack/rte_stack_lf_generic.h b/lib/stack/rte_stack_lf_generic.h index 4850a05ee7..7fa29cedb2 100644 --- a/lib/stack/rte_stack_lf_generic.h +++ b/lib/stack/rte_stack_lf_generic.h @@ -128,8 +128,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