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 F292341EC0; Sat, 18 Mar 2023 19:26:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E30AE40ED8; Sat, 18 Mar 2023 19:26:49 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 6A9A040151 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-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-494-VCu-pIQlPKeZ3j7xF6_Sww-1; Sat, 18 Mar 2023 14:26:46 -0400 X-MC-Unique: VCu-pIQlPKeZ3j7xF6_Sww-1 Received: by mail-pl1-f199.google.com with SMTP id l1-20020a170903244100b001a0468b4afcso4527138pls.12 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=F1WrT00ybuLIZ2371ITU5jz0ZWw2Qc2f9vaQMyZqMakjravD8vmYI7ObaMZtYrhC2w Bs11LVNXgm51+95lxGxKZjFytKpVqB85C42s0cTTMyYVaYSNmPy5683pU38wXZeC6FQ6 K6X4pu9VxuxhRIXRzloToElj0h1h6VB4r+HCZHxwvksnCRmpHPCwRYz4uRjA6PvOWQSN XW8UotwRHx9/zMRjhVzfQVO3eSMbGWP4Aodn437a6znA1g2RM1L8vjHq7K5+gDAzANqg +k5PCfWMrgYS1Hm7DhKUzjrGzAd4fNV1y9c6ZFASzCqPQ6Q6+Nq7X3C5CAmBbm5xGBfM 6U1A== X-Gm-Message-State: AO0yUKVGrGRjz+UazCAd2wl/7GlY/rGiT/znyGxuUaBaVrlU5gNAyu9W WhDjSX5L+gIY/9tR5tAV9APVCsNwN5Dbqr9qXON+gjlsp6/SXz3mj78GPYxDMOqY+yASFW0GFxw c5u59kXyVuQKcW27kOYQ= X-Received: by 2002:a65:66c5:0:b0:50b:e523:3cd2 with SMTP id c5-20020a6566c5000000b0050be5233cd2mr569310pgw.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: 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 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