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 0E97F41EC3; Fri, 17 Mar 2023 22:24:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C48C042FEE; Fri, 17 Mar 2023 22:24:15 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 48F8642F98; Fri, 17 Mar 2023 22:24:14 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 96AEA20C343B; Fri, 17 Mar 2023 14:24:13 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 96AEA20C343B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1679088253; bh=rjtZi3dHtaQAZdl9wtDZxNMHHykyo0hm1a0Vec9B9ZY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LSmiT9CeZpHtSWONdcuWTy5Ihl8AJd0aWursBKRfcPx22CMUXAAcfe9cHxJ/FMuV0 oFIsk+WVnTIT9KfbtLSbDrWZcxniQKztxluzpHfBqL/MwAkr3Xp/hcUpHZcZmJ0yIf 1Eo5nbh4rx0X/8IprI2Xfb0hfbBrSvGaIeiatoU4= Date: Fri, 17 Mar 2023 14:24:13 -0700 From: Tyler Retzlaff To: David Marchand Cc: dev@dpdk.org, thomas@monjalon.net, stephen@networkplumber.org, stable@dpdk.org, Narcisa Vasile , Dmitry Kozlyuk Subject: Re: [PATCH v6] eal/unix: fix thread creation Message-ID: <20230317212413.GB26815@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1677782682-27200-1-git-send-email-roretzla@linux.microsoft.com> <20230317185229.449011-1-david.marchand@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230317185229.449011-1-david.marchand@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Fri, Mar 17, 2023 at 07:52:29PM +0100, David Marchand wrote: > From: Tyler Retzlaff > > 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 the above by setting the affinity from the newly created thread > using a condition variable to signal the completion of the thread > start wrapper having completed. > > Since we are now waiting for the thread start wrapper to complete we can > allocate the thread start wrapper context on the stack. While here clean > up the variable naming in the context to better highlight the fields of > the context require synchronization between the creating and created > thread. > > Fixes: ce6e911d20f6 ("eal: add thread lifetime API") > Cc: stable@dpdk.org > > Signed-off-by: Tyler Retzlaff > Signed-off-by: David Marchand > --- Looks good to me, not sure if you need a Reviewed-by: from me for the changes but here is one anyway. v5 Reviewed-by: Tyler Retzlaff