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 37D9041E09; Tue, 7 Mar 2023 15:33:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8374E410FA; Tue, 7 Mar 2023 15:33:46 +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 4069040EDB for ; Tue, 7 Mar 2023 15:33:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678199623; 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=QoUlIJ5nM6MoXB3i/CWtU49B58i+ustZHoS/rJ+ZUCU=; b=RS7E2H3gTVTfl5ocCZk+WWHPBzgx0Hd0WYiv98LqI77oT7BzIO2j2DKOd7GTTmyGMgBQnf aJkTXNKZtZ3WlRT8lpBzzJ35ySqFp2UTLQndvA9hZ5EZU54Nv7JClQ4VvFy+aM9ftbioXx j1uqsURq4DQUR4c0EP4oAh9ACkK+jvE= 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-142-v81kbSWWNf68QGkNgwa9wg-1; Tue, 07 Mar 2023 09:33:42 -0500 X-MC-Unique: v81kbSWWNf68QGkNgwa9wg-1 Received: by mail-pj1-f71.google.com with SMTP id pl10-20020a17090b268a00b00239ed042afcso8166177pjb.4 for ; Tue, 07 Mar 2023 06:33:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678199621; 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=QoUlIJ5nM6MoXB3i/CWtU49B58i+ustZHoS/rJ+ZUCU=; b=vM58QH8T0ma3B+ghu2Q3Zt4x7S8dUcXrz6ar5S/KSvxR+lCVMW7bHJdYNb10wfCiOL zd24qaV1pjjfMN3Y/GJO3A2sA0krc4mwPBgFqOwqPbCP8bgja5AbWFhjm7sSaqvTukoW xyAg/+1ubEu4+fk4IVrirm82g9lQTmh5PIGA4AvWtVPMUb8fZNB4XkWdY9YFTx7eg6+Q cYcbISye+IsFfQ9KXBqbRmVwenY0llUuGoE+uZtP4du7Gl+gEZ8OR0wTRm3tW5HAwMSO eLNTJtqDxkQ3luw+VflNhgP6FT7on+WsbZgZBkGKEdhgiwx2xXmSVHevfARkMh0cwJLk bZyg== X-Gm-Message-State: AO0yUKVRrw9qQh/ecqFf9lvKwDl1nNB869Xh75z/fAYMze0jWkC8GwNU C91vdAlnh7/WGePmrDtrF7CH8A7Q/OMjwcKEaUPigGFoD6uymSS5GITghVnmKZkmqxEB9Z/r+9p /mSNNSxMkroruK+YdSaI= X-Received: by 2002:a17:90a:8a82:b0:234:b4ad:d598 with SMTP id x2-20020a17090a8a8200b00234b4add598mr5429359pjn.7.1678199621109; Tue, 07 Mar 2023 06:33:41 -0800 (PST) X-Google-Smtp-Source: AK7set9F4y4yb/gc4FMjl1nmU59cXGr3IA9qSEcOq5EdgoXFuXrHqyI1ArtrfFPQIRSaYKvrLu3frCUM8LPx12awSBg= X-Received: by 2002:a17:90a:8a82:b0:234:b4ad:d598 with SMTP id x2-20020a17090a8a8200b00234b4add598mr5429347pjn.7.1678199620749; Tue, 07 Mar 2023 06:33:40 -0800 (PST) MIME-Version: 1.0 References: <1677782682-27200-1-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: <1677782682-27200-1-git-send-email-roretzla@linux.microsoft.com> From: David Marchand Date: Tue, 7 Mar 2023 15:33:29 +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: 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 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 new > 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 --=20 David Marchand