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 6F4CD41E38; Thu, 9 Mar 2023 10:58:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F383C40ED7; Thu, 9 Mar 2023 10:58:11 +0100 (CET) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by mails.dpdk.org (Postfix) with ESMTP id 33EDA400D7; Thu, 9 Mar 2023 10:58:11 +0100 (CET) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 889F63200931; Thu, 9 Mar 2023 04:58:09 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 09 Mar 2023 04:58:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1678355889; x=1678442289; bh=nuMNuoMnqxOr4HYoaw7TGXqI5Eu8oQFeuBh vSD7D11k=; b=EAItB+5ToOwhwYwUbe5Sd29btRlXAZ8xeVTx48eqdxAMzOG7YDn OKmIwkowHlBXGtYzG9UpIQ9sqmO0uJI9s/xmcjbiAkbYiSukX6GKjefHxo56jWD7 Zy3/c32AAK9U3uIntWQMOsHXvC05rkS4bgRxln8ufEWLNrFu0f4ni6hhez94V7A5 3cBamd4SNLolT995q7ysiuvTPLitELko3IeCgT8i51t2t5YrEDnu6KEXetwUdrO+ nbA+v/cAyjxEmcVrLz90zaJdZWJncC/0Pyi7nWfw8sa32QqJQCm6mWMXnNL/r3sU BNcqRqDTJ1ECUit92nG9E/IKI/Qo+kqWqRA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1678355889; x=1678442289; bh=nuMNuoMnqxOr4HYoaw7TGXqI5Eu8oQFeuBh vSD7D11k=; b=a/wql/6SDF7/l0SbtQZC1SeqR+Cq7cpKqCODimfHOKA3YUHK1fQ RmpIYi1/V8thjDUMlWUjwHFLcSM/7Hz9MELqyCz+byhOwN9xEH/iJOZhx/jMcC1W UPhxcGPT3qVxOBprC4LPxwlWhv0ZOB6pu4UbxN0eEvQ51DDtiGApRzh6Y2yKMWnV GnnbbLpMBrbNLHScOrzPQ9lbEgVBtBhesX96WR19DNs6cVwyKWz7VQydvDvoslU/ an857USPxll08ab19nLo7F/i5gRxkGmzdm6e5RcuxCk44W+AKoXXXOr7GxIJ5HsR fsh0q13laqY6Wz8z9tSDd4iv4nvcZ226VGg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdduiedgtdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkjghfggfgtgesthhqredttddtjeenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpeegtddtleejjeegffekkeektdejvedtheevtdekiedvueeuvdei uddvleevjeeujeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 9 Mar 2023 04:58:08 -0500 (EST) From: Thomas Monjalon To: Tyler Retzlaff , David Marchand Cc: dev@dpdk.org, stable@dpdk.org Subject: Re: [PATCH 1/2] eal: fix failure race and behavior of thread create Date: Thu, 09 Mar 2023 10:58:06 +0100 Message-ID: <3722941.kQq0lBPeGt@thomas> In-Reply-To: References: <1677782682-27200-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" 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 09/03/2023 10:17, David Marchand: > On Tue, Mar 7, 2023 at 3:33=E2=80=AFPM David Marchand wrote: > > On Thu, Mar 2, 2023 at 7:44=E2=80=AFPM Tyler Retzlaff > > wrote: > > > > > > In rte_thread_create setting affinity after pthread_create may fail. > > > Such a failure should result in the entire rte_thread_create failing > > > but doesn't. > > > > > > Additionally if there is a failure to set affinity a race exists where > > > the creating thread will free ctx and depending on scheduling of the = new > > > thread it may also free ctx (double free). > > > > > > Resolve both of the above issues by using the pthread_setaffinity_np > > > prior to thread creation to set the affinity of the created thread. By > > > doing this no failure paths exist after pthread_create returns > > > successfully. > > > > > > Fixes: ce6e911d20f6 ("eal: add thread lifetime API") > > > Cc: stable@dpdk.org > > > Cc: roretzla@linux.microsoft.com > > > > > > Signed-off-by: Tyler Retzlaff > > Reviewed-by: David Marchand >=20 > Series applied, thanks. Unfortunately we cannot merge this patch because it does not compile on Alpine Linux (musl libc): lib/eal/unix/rte_thread.c:160:31: error: implicit declaration of function 'pthread_attr_setaffinity_np' Is it possible to fix the race without using pthread_attr_setaffinity_np?