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 0D3FD41E38 for ; Thu, 9 Mar 2023 10:17:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0811742BAC; Thu, 9 Mar 2023 10:17:31 +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 CE0DF4113D for ; Thu, 9 Mar 2023 10:17:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678353448; 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=iJWBzbp1qgp43Z5dExMbuE8cpx47QnWMW90gWpG/qxk=; b=i495lVGdIAnOae6VKJJnTKmt3ebTwnBabS28r0ko4j64Ja81LySifOGjbhLVBLctx86Fob HnyGGbqTzNg0HdsJwnsgiEW/iIHZS9Gb6vdN5VhyeBe44sk7GVWGe6tcvUoi9feAmAG7Sw Xr877ad/37HgmhKTnMLkLSwbpEis78A= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-537-k0PO-tq_MjylB5qs3uGm3A-1; Thu, 09 Mar 2023 04:17:19 -0500 X-MC-Unique: k0PO-tq_MjylB5qs3uGm3A-1 Received: by mail-pl1-f198.google.com with SMTP id ju20-20020a170903429400b0019ea5ea044aso803240plb.21 for ; Thu, 09 Mar 2023 01:17:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678353438; 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=iJWBzbp1qgp43Z5dExMbuE8cpx47QnWMW90gWpG/qxk=; b=HreEXpNzKMavAdRCuxJ12c8mPJkgipdEUs6MR/IcuzydZKdg/FmnYEm6ADREpxsc/l mRmCXaj8bbFAMxtTGE4sNRKRpARW9cJVfjlM4vvbEPa0NatZjKDWbcarTzKlQBmZlRxb CMFLplhOuETlkdJeN4+wZIlHIMc4Zjh8nqftQy8ywITi/lsqOPta/3XnviF/2J9cI7XV KDj5snBj2k8xP51G1nD+ZHRnPv4IVn5xOwdq8sCja7AdbKWN7cznAfHpx7ogg2EXlOoP tleivxQVUXotWIISQt+4h21Cd63YRi49zYhikeiU34nKAmaN4XdOFui3pLvDFkJYopOC vCuA== X-Gm-Message-State: AO0yUKUiS3F6LkybHCSCvs017TakRfEfLBPFBfePL/F984YMqRhd+3iz X5dkmKJObwfBC3R2c3LWBhf/7ez+zJISc7KeCw5BPGG/6P9VMY9zxS66HrTtrfnJBRJm67OuwRK bsHffOcHkQOczEBNYXBjb/0U= X-Received: by 2002:a17:90a:7bc6:b0:22c:2048:794e with SMTP id d6-20020a17090a7bc600b0022c2048794emr7681285pjl.7.1678353438314; Thu, 09 Mar 2023 01:17:18 -0800 (PST) X-Google-Smtp-Source: AK7set8d89/SkB05x5BUCN9WCm1hUfTWwJ1xpFa3Nam6IVEZ1JUl64rSI4Rq9FQHQ6FLDoJSEHhFwHN8yF+RskbeP5k= X-Received: by 2002:a17:90a:7bc6:b0:22c:2048:794e with SMTP id d6-20020a17090a7bc600b0022c2048794emr7681280pjl.7.1678353438000; Thu, 09 Mar 2023 01:17:18 -0800 (PST) MIME-Version: 1.0 References: <1677782682-27200-1-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: From: David Marchand Date: Thu, 9 Mar 2023 10:17:06 +0100 Message-ID: Subject: Re: [PATCH 1/2] eal: fix failure race and behavior of thread create To: Tyler Retzlaff Cc: dev@dpdk.org, stable@dpdk.org 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 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 ne= w > > 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 Series applied, thanks. --=20 David Marchand