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 CC4BE41EC0; Sat, 18 Mar 2023 19:26:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5CF9440691; Sat, 18 Mar 2023 19:26:21 +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 C075140151 for ; Sat, 18 Mar 2023 19:26:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679163978; 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=vkhzmgQCtt5jdEgvEBJFI1o7w9Qhnolno0jNgz2RlQU=; b=VFol2/BfwCjHwqYAJ2fmehF5nNT4gmkEANQ6/IKM4PFZ33rrWUj7BD1vIOlfW/HNugml8M r+kmIIehkoIcEHX6Ne7Hpf0OqYGIDa27cymh/EAYBbCSn/KyU952/TLWok+FYPnc+3S75x Ff/RDOcHcu1JRpgrBxSJxbL7t+npgYI= Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-502-UiOxFVhvO-aBNucKW3YSUg-1; Sat, 18 Mar 2023 14:26:16 -0400 X-MC-Unique: UiOxFVhvO-aBNucKW3YSUg-1 Received: by mail-pl1-f197.google.com with SMTP id e5-20020a17090301c500b001a1aa687e4bso2523566plh.17 for ; Sat, 18 Mar 2023 11:26:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679163975; 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=vkhzmgQCtt5jdEgvEBJFI1o7w9Qhnolno0jNgz2RlQU=; b=RpJvY0sS//SGRt5IquMizhmtWuvpoObenhrP7FFM2am/5/RHGx4/jK74Bb+WvLhhuQ LEKzAwrgGL7lZrp5NnL2fac7efjS/T2rPsYyvUTsFwqusAwFzI40bEWKKpvGSZY3F/uQ WeoPLaEMBs4m310TiVfBPM9fBx4Z2Soot52AiDXi4D0NWanorJ14H/2Z7qVInskV8dHo ft62intHWnYuBO1BuKF86AXauONKwn+bEDaWwSJLJ3ELlHpbcIAmq2jpiC7m7lxmipm3 xxHhl/axLbixT5/gIFN/WGd9m/0CPxRPr4bGNY7/MEfBNuXd2iXtEidQVSyi/aSOBqTn /Agw== X-Gm-Message-State: AO0yUKURETSS6CKN+S1W+CKAspWNvJL4OC8iACi+eWV3/Sd5syGBPo5Q R7hOOGAj+SAjC+RXWt78RVz3oyrA3XlzIkaOWTSMSnsGnorCwU0PJJ3O47blc7hr1mHAyBXRJxf 3fNZ7o5/CI9PPSFUH5Qc= X-Received: by 2002:a17:90b:108c:b0:23f:6efa:bd55 with SMTP id gj12-20020a17090b108c00b0023f6efabd55mr1124180pjb.8.1679163975599; Sat, 18 Mar 2023 11:26:15 -0700 (PDT) X-Google-Smtp-Source: AK7set9SjUHzhuy23e9E137mVeFAouNX8E0sF0SNLNM2GxtdpF9epZTsaUJOV+s5r5g5uzifvMwbqrygAXYFO27Sw+0= X-Received: by 2002:a17:90b:108c:b0:23f:6efa:bd55 with SMTP id gj12-20020a17090b108c00b0023f6efabd55mr1124173pjb.8.1679163975185; Sat, 18 Mar 2023 11:26:15 -0700 (PDT) MIME-Version: 1.0 References: <1677782682-27200-1-git-send-email-roretzla@linux.microsoft.com> <20230317185229.449011-1-david.marchand@redhat.com> <20230317212413.GB26815@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> In-Reply-To: <20230317212413.GB26815@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> From: David Marchand Date: Sat, 18 Mar 2023 19:26:03 +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 10:24=E2=80=AFPM Tyler Retzlaff wrote: > > 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 ne= w > > 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 ca= n > > allocate the thread start wrapper context on the stack. While here clea= n > > 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 Thanks for the review, I'll keep your SoB only on the patch. --=20 David Marchand