Hi Stephen:

> -----Original Message-----
> From: Stephen Hemminger <step...@networkplumber.org> 
> Sent: Tuesday, May 31, 2022 12:29 AM
> To: Zeng, ZhichaoX <zhichaox.z...@intel.com>
> Cc: dev@dpdk.org; Yang, Qiming <qiming.y...@intel.com>; Richardson, Bruce 
> <bruce.richard...@intel.com>; hka...@marvell.com; david.march...@redhat.com; 
> acon...@redhat.com; Matz, Olivier > > <olivier.m...@6wind.com>; 
> tho...@monjalon.net; sta...@dpdk.org
> Subject: Re: [PATCH v3] lib/eal: fix segfaults due to thread exit order
>
> On Mon, 30 May 2022 13:47:38 +0000
> zhichaox.z...@intel.com wrote:

> > @@ -883,6 +896,8 @@ rte_eal_init(int argc, char **argv)
> >  
> >     eal_mcfg_complete();
> >  
> > +   pthread_atfork(NULL, warn_parent, scratch_child);
> > +
> >     return fctret;
> >  }

> There are lots of other cases where DPDK will die if you fork() in a DPDK 
> process then call DPDK functions in child. 

> Not sure what the problem you are trying to solve is?

The original goal of this patch was to cancel eal-intr-thread before memory 
cleanup to avoid a small probability of segfaults. 

But in the debug_autotest test of dpdk-test, fork() is called and the exit 
process is tested in the child process which will call the rte_eal_cleanup 
function and mistakenly clean up non-existing threads. This will cause 
segmentation fault. 

Based on patch v2, atomic operation is added to determine whether it is a child 
process, so that the cleaning process will not execute in the child process to 
avoid the above problem.

Regards

Reply via email to