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 E8D83A0548; Thu, 2 Jun 2022 10:21:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 92B5C427EA; Thu, 2 Jun 2022 10:21:27 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id D3CC94021E; Thu, 2 Jun 2022 10:21:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654158085; x=1685694085; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=dhI4A+CB6UQF0KaHck2bYbfJMV1sFUk3gWShAD2oCMY=; b=YXgdcQo/3rxYqXOFa7eld1Izk6C7kK5uPNdO0yt4IjGIe2v6FMkuf1/Y FwWuOFI5NvPIi2+pANpraVzfrj0aEV6vFe03q5iiEWltmjEvaWbeqFq5C +VjPNlfw3693V9wJkIm1+ZwKkFH3A0ycKWjoI08EqF8TOMoY0rtrAvDaI Rnl7WrB4E3t4TmnH/oUDMxNam9BSrK15HFlLhcqEliyYOjjtAwOIm3mU6 vgQrATsWH0gVnFgMQSygVUEz/+JqNlwoZvE1d86jbouhBK3ACWkCQUr85 DF2koo38PYwf4ZlMxlpSwWqefOynixUSJJ8FuXjgf9kzp4POvfJZJAX+k Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10365"; a="338920886" X-IronPort-AV: E=Sophos;i="5.91,270,1647327600"; d="scan'208";a="338920886" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2022 01:21:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,270,1647327600"; d="scan'208";a="707463050" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga004.jf.intel.com with ESMTP; 02 Jun 2022 01:21:23 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 2 Jun 2022 01:21:23 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Thu, 2 Jun 2022 01:21:23 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.49) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Thu, 2 Jun 2022 01:21:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MPHK9wjV7Y/8lJpX/MkEPXFn0YUSfYoBSUswMsofFZwjGReTs17JGvnjuvZe71CS4guZbQlzmPUbTOB/3Dc5vdlJeKoMIv1RYkde0J91OFNWuENh8Mb8/e8ZaLasUiJ26V2vWGb3f3cLImB0Lq3cjvx6XcH154zLM3Abp04AYnlt4xcSknrpVj8S3LlppEZmcFPheup3EdDaCkYSLd3D25vFVlqvAQwTKdvaTuqO8jedQWgZc18LrCBOOCjL3Dko3SCUb9IhiPu/Zg1MGbJPiIK6W5d1z3SmTGm/Wyv6/oSFTvLjAHKpzQhnzC+3lmCd492RNlQl/WuMqWDr9ZftsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=biyTcSGaE1tAVtcl26j57Vjqvq0bQweYG45CN3VIq5I=; b=brHfWYFWzmoG/ek+m8qIWcRlaMFg/XMOa01yLAZy7erC/7gBe+j8B+Ro35iDGTgNpL4t7vuZm+UoVcAqhCkoCznrHzezRjOErDikmdrVvZpvzBKxO4h7tmyuITpdXGkWhHllRfx5xL5t4SgeOGB8GQN144wWcTLfK1RGr7wIyEhIEbgAARIRqgX6c4JUgM/qrX5FAI8Rg2YzWFz1xKkeFbEpKb2/QagcvuEdTHiKr1a4NDjtrOIaUcJFvSfZ2/+WAIvLm3L1H/jbOU9HX2rC4cpFJ489UnOF/9kneWjoRv3EONksqxKA/LnX26IqKf8TzPlSUrRogmwyYS1uxsnICA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from CO6PR11MB5602.namprd11.prod.outlook.com (2603:10b6:303:13a::5) by BN7PR11MB2676.namprd11.prod.outlook.com (2603:10b6:406:ac::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.16; Thu, 2 Jun 2022 08:21:19 +0000 Received: from CO6PR11MB5602.namprd11.prod.outlook.com ([fe80::a0a0:842:e19d:e5df]) by CO6PR11MB5602.namprd11.prod.outlook.com ([fe80::a0a0:842:e19d:e5df%7]) with mapi id 15.20.5314.013; Thu, 2 Jun 2022 08:21:19 +0000 From: "Zeng, ZhichaoX" To: Stephen Hemminger CC: "dev@dpdk.org" , "Yang, Qiming" , "Richardson, Bruce" , "hkalra@marvell.com" , "david.marchand@redhat.com" , "aconole@redhat.com" , "Matz, Olivier" , "thomas@monjalon.net" , "stable@dpdk.org" Subject: RE: [PATCH v3] lib/eal: fix segfaults due to thread exit order Thread-Topic: [PATCH v3] lib/eal: fix segfaults due to thread exit order Thread-Index: AQHYc+jZCxt9Qc+HpEe/EKl0LmAnw603nOAAgAQklbA= Date: Thu, 2 Jun 2022 08:21:19 +0000 Message-ID: References: <20220523111642.10406-1-zhichaox.zeng@intel.com> <20220530134738.488602-1-zhichaox.zeng@intel.com> <20220530092852.54638bdf@hermes.local> In-Reply-To: <20220530092852.54638bdf@hermes.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4c00cc81-d787-4089-eb6c-08da4470def2 x-ms-traffictypediagnostic: BN7PR11MB2676:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MVuPN3id2tFkgZpD8AgP71RwvDe5XESmwJmfCNFP2KW50sTPav65nfOsMr8Z6VIQV5tKC4aZkDhjiWWnZsgE/Kep5Hwn+XXYXgdgKdnRn8QHrx8sXDUhQ47cFk9be/fC+8pWBXUcCOO4NixPtAv6/oRtlWKXe1qT69rIZ7vIVwQfb8la7wa9VnnTw3ByK1w/seB4Vmjd/DbVwh4Uyun2LhsUvxSleZHeaeoTka6FMZg2iQ5IPQX/R1LqrKvki9E5GihkCdutyyxLcvBPFXu3u352LLfsIwj/ahrrm9+VQP2RA+fjHaa4rssT3vz4TP9ZU+QDE/b4foJTE/Nzvo+W+Z/UWODueZ6pI11PlrZgZeqmW0HrTDryr+5EsvdI+btRm4xB6bkW/mWDtqqi3JghxS8a5r4Gh/SszhQx0u7ybS2OYUY4pYj/eypMNjtgkmCV/Jcw7cZqXMFAPRAknshbRGLr38nO4V9vxhxLD8Sci2S0Z6PrEF7lX38/SYrn9lCzY8EtusxyJy5NDoCiddtDq2+nPjiTUTypvU3e9p6FEKbJaoeD7eVt2fQzbs/E/XcgM8zdkeMrgL4bItKoLEwBM0LO3QR0GmW0IY+rDIT8DR/ppb3HB+NkQZoiqreumCis+nio3B2lgeV7vVt3eVrY2j4vlD6uQQgJSRskHhdawrXeSurVElKhuklTzh95QwShRH8bbeshWMXbHP5D1THOJA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR11MB5602.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(6916009)(316002)(2906002)(83380400001)(33656002)(122000001)(26005)(6506007)(186003)(5660300002)(7696005)(9686003)(53546011)(71200400001)(8936002)(52536014)(55016003)(508600001)(76116006)(82960400001)(4326008)(66556008)(54906003)(38070700005)(38100700002)(66476007)(66946007)(66446008)(86362001)(64756008)(8676002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?NNpvJRvAtMDPBFDJB/s65HFcCCL0fMf8qcfh3wY3N41/zoAOZiUQDcc/JhQ+?= =?us-ascii?Q?qaaOhlEIEr5w/g49cO4XTM+D0OnEHR3knwf0kwmADESIKBds82RNCQSne+0Q?= =?us-ascii?Q?UsZ3ahnSqJSiU6Ine4kKqUifUbhcHgCJYrKAI1+Q55QQShXEXfCC9gpGmLXP?= =?us-ascii?Q?lxnfbO5P0ubjah3o8gXUh4sWXwvT2TH5hTuLBoABa/HIjM3R97LaDNTcd9iG?= =?us-ascii?Q?V2CgA8v/pCxpA3FS4eyB7A8rhHjkSjmaufCubxQ4zqjIh99jz8bcrlsoGywO?= =?us-ascii?Q?u5LdNbppFdVMN6a634FbMomglookIcVK2Q5EDxf2gXh5l4cMfsJ4CxPdxg5t?= =?us-ascii?Q?1fT6di6K9AaJdW6Hm5pP/F66wfzspCh+u9A8L12JD4sUGlUCOAIVzH7FJKjU?= =?us-ascii?Q?kAXknkb1CHzKiSm8ExJrkVy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QGsZ/thR1+?= =?us-ascii?Q?SoyopfpAbUd/OQOK4t+mXbDhwPRXXVaOQlQyQsdcSu5P53Hy2LlRMYYr6dqH?= =?us-ascii?Q?4LQlcFS63Pnkh9CqNh9C6ncI7RclvsYTGUn46UnjSLScNDO0MS9yCqHRbY5s?= =?us-ascii?Q?d1SzJwPB2dC4+UiLSxjD8ubw84CRst23JeZiOj1R8uoU5MYbqNTC+T+GEweU?= =?us-ascii?Q?RRhS4Tyv9MCRNfl83RjoM3Aawlv65WdA3DAvsFlNVK6XkeoSkT4RjJw9W1Sw?= =?us-ascii?Q?YFbPx8Ly/hFKH64qh9y9aT1pdwxUwVtuQoQQYZrxpZzM4Tk1Oy78vfrKSISm?= =?us-ascii?Q?IZSDIUCiHidF5HWvcAuL8QIGVNlFaoy78yxsDgbcYuzdmY44857M0svm1Yjb?= =?us-ascii?Q?UwOwjzR0OZFlrsBM3VP0WOh1+AoVkgHBeQrPbmGpIfr/xdAKABnZkjf8KUeA?= =?us-ascii?Q?uoIOaDhiww=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR11MB5602.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c00cc81-d787-4089-eb6c-08da4470def2 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jun 2022 08:21:19.3678 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: roL7FZUa+5SWRIg6zod6jB5LR5QiZ1OhduhTtjnxBfY5WorEiXaDiVLplH66SY26HMX/q7NR591vskOHa/431Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR11MB2676 X-OriginatorOrg: intel.com 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 Hi Stephen: > -----Original Message----- > From: Stephen Hemminger =20 > Sent: Tuesday, May 31, 2022 12:29 AM > To: Zeng, ZhichaoX > Cc: dev@dpdk.org; Yang, Qiming ; Richardson, Bruce= ; hkalra@marvell.com; david.marchand@redhat.co= m; aconole@redhat.com; Matz, Olivier > > ; thomas@m= onjalon.net; stable@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.zeng@intel.com wrote: > > @@ -883,6 +896,8 @@ rte_eal_init(int argc, char **argv) > > =20 > > eal_mcfg_complete(); > > =20 > > + 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.=20 > 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.=20 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 segm= entation fault.=20 Based on patch v2, atomic operation is added to determine whether it is a c= hild process, so that the cleaning process will not execute in the child pr= ocess to avoid the above problem. Regards