[PATCH v6] eal/unix: fix thread creation

David Marchand david.marchand at redhat.com
Sat Mar 18 19:26:03 CET 2023


On Fri, Mar 17, 2023 at 10:24 PM Tyler Retzlaff
<roretzla at linux.microsoft.com> wrote:
>
> On Fri, Mar 17, 2023 at 07:52:29PM +0100, David Marchand wrote:
> > From: Tyler Retzlaff <roretzla at linux.microsoft.com>
> >
> > 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 at dpdk.org
> >
> > Signed-off-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
> > Signed-off-by: David Marchand <david.marchand at redhat.com>
> > ---
>
> 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 <roretzla at linux.microsoft.com>

Thanks for the review, I'll keep your SoB only on the patch.


-- 
David Marchand



More information about the stable mailing list