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 1D32A41EC0 for ; Sat, 18 Mar 2023 19:26:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 06999410EC; Sat, 18 Mar 2023 19:26:51 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 7540940ED8 for ; Sat, 18 Mar 2023 19:26:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679164007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W7knF2zGOF5zoAEBiKk7h2wBAVzNirPrKue90B477fc=; b=OnTedS8tfbrGOE5yT1mh8kae7pwSX5fb4VCivX2983LouvhvvOusZw3diy4Jyi98GYs3BM fbmh/Sw9FZhK/uob07EsSrOt/ql6KPgIxUkGZChDaAVObo9up+mk3lztTIk84MLlWnPPM0 hq6FW/8Q9a6tbhyRobO8cBP4/cyZquU= Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-251-8Tl3sfgqODCKenZwWIf27Q-1; Sat, 18 Mar 2023 14:26:46 -0400 X-MC-Unique: 8Tl3sfgqODCKenZwWIf27Q-1 Received: by mail-pj1-f71.google.com with SMTP id v15-20020a17090a458f00b0023816b2f381so3030138pjg.2 for ; Sat, 18 Mar 2023 11:26:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679164005; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W7knF2zGOF5zoAEBiKk7h2wBAVzNirPrKue90B477fc=; b=0IeJF+Cl4VuWrx5Edv4m9qGHmEG/XTqp8+0UDpABhvM81zTL5i53wVACuDRkTvkFZt OFkZyYm7n1oqd+F5A5l+saM3dzDQ6AKhZIX++Q2T/TK5lDSGpq7fNpll0M2iwRf7gdDy 6+RWgkZYsxkIiYWfWrHSG7SW8MnyTNCjBk68C9moQ8gHL3soXZ3tTDvB/pufsUY20cuX LKcgP60KqFqjJ5X64oRDgW0c5rjNw7th5yWl266shCaUUfKJGfqdbHQaPH3rA32/+53v wBM5OFG3Qymvclfpt7n1hvbYx186Sa4KsW8uqZHfgQxPxJ6sjbguOUfVGIHz34d/Z0SN FVaQ== X-Gm-Message-State: AO0yUKVci/0TWfBaMkeen28OXf699PC1R6Q92AULF7QxJKt0y50UPlqk 0Syi2y+mwbbyZgJDYUciRSyWE2pmyDbvULv8dTlIuqbMOyJEv699p6rQCdtsw4iijmkJ5YFVJc9 X95rfgxd1ssj7SxxQDsCbpAw= X-Received: by 2002:a65:66c5:0:b0:50b:e523:3cd2 with SMTP id c5-20020a6566c5000000b0050be5233cd2mr569311pgw.11.1679164005471; Sat, 18 Mar 2023 11:26:45 -0700 (PDT) X-Google-Smtp-Source: AK7set+pswRQBmWiWCHsmGci8Szb2ZKu4+CRR1h0nO0lBt/3FzD8zDs+OHB0nnTyCixZSb7U7dHafq6UqsH9f8+5xhY= X-Received: by 2002:a65:66c5:0:b0:50b:e523:3cd2 with SMTP id c5-20020a6566c5000000b0050be5233cd2mr569306pgw.11.1679164005219; Sat, 18 Mar 2023 11:26:45 -0700 (PDT) MIME-Version: 1.0 References: <1677782682-27200-1-git-send-email-roretzla@linux.microsoft.com> <20230317185229.449011-1-david.marchand@redhat.com> In-Reply-To: <20230317185229.449011-1-david.marchand@redhat.com> From: David Marchand Date: Sat, 18 Mar 2023 19:26:34 +0100 Message-ID: Subject: Re: [PATCH v6] eal/unix: fix thread creation To: Tyler Retzlaff Cc: dev@dpdk.org, thomas@monjalon.net, stephen@networkplumber.org, stable@dpdk.org, Narcisa Vasile , Dmitry Kozlyuk X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Fri, Mar 17, 2023 at 7:52=E2=80=AFPM 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 Applied thanks. --=20 David Marchand