Hi Stephen: > -----Original Message----- > From: Stephen Hemminger <[email protected]> > Sent: Tuesday, May 31, 2022 12:29 AM > To: Zeng, ZhichaoX <[email protected]> > Cc: [email protected]; Yang, Qiming <[email protected]>; Richardson, Bruce > <[email protected]>; [email protected]; [email protected]; > [email protected]; Matz, Olivier > > <[email protected]>; > [email protected]; [email protected] > Subject: Re: [PATCH v3] lib/eal: fix segfaults due to thread exit order > > On Mon, 30 May 2022 13:47:38 +0000 > [email protected] 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

