From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 097571B7DD for ; Wed, 31 Jan 2018 15:55:00 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2018 06:55:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,440,1511856000"; d="scan'208";a="200257080" Received: from irsmsx109.ger.corp.intel.com ([163.33.3.23]) by fmsmga006.fm.intel.com with ESMTP; 31 Jan 2018 06:54:59 -0800 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.95]) by IRSMSX109.ger.corp.intel.com ([169.254.13.19]) with mapi id 14.03.0319.002; Wed, 31 Jan 2018 14:54:58 +0000 From: "Van Haaren, Harry" To: Thomas Monjalon , "Ananyev, Konstantin" CC: "dev@dpdk.org" , "pbhagavatula@caviumnetworks.com" Thread-Topic: [dpdk-dev] [PATCH v2] test: fix debug autotest with eal cleanup addition Thread-Index: AQHTmqBUsAePMS99iUSNEAa6uWj26qOODgYA Date: Wed, 31 Jan 2018 14:54:58 +0000 Message-ID: References: <1517336497-17943-1-git-send-email-harry.van.haaren@intel.com> <1517336769-18052-1-git-send-email-harry.van.haaren@intel.com> <2601191342CEEE43887BDE71AB977258905663C3@IRSMSX103.ger.corp.intel.com> <10693804.qgnIZzW71k@xps> In-Reply-To: <10693804.qgnIZzW71k@xps> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDMwZjI0ZjMtNDdkNy00YmRhLTg4NDctMWNhN2I1MzA4MzcyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJGY2xIXC9LeWZpQU5XZUZVRVVuRTVJK2JpWTdxT2k4UzROXC9YOGxkN2d5WUpuU0lcL2p1bDVIa0NBRDR1RDB6enRIIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] test: fix debug autotest with eal cleanup addition X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 14:55:01 -0000 > From: Thomas Monjalon [mailto:thomas@monjalon.net] > Sent: Wednesday, January 31, 2018 2:32 PM > To: Ananyev, Konstantin ; Van Haaren, Harry > > Cc: dev@dpdk.org; pbhagavatula@caviumnetworks.com > Subject: Re: [dpdk-dev] [PATCH v2] test: fix debug autotest with eal clea= nup > addition >=20 > 31/01/2018 14:53, Ananyev, Konstantin: > > Hi Harry, > > > > From: Harry van Haaren > > > > > > Before this patch, the debug_autotest would call fork(), > > > call rte_panic() or rte_exit() in the child process, and > > > examine the return code to verify that rte_panic() and > > > rte_exit() were correctly reporting failures. > > > > > > With the inclusion of the rte_eal_cleanup() patch, rte_exit() > > > was modified to cleanly tear-down EAL allocations. Currently > > > only one library (service cores) is allocated by EAL at startup > > > and should be cleaned up. This library has a check on a normal > > > (non-hugepage) variable to protect against double cleanup. The > > > service cores finalize() function itself frees back hugepage mem. > > > > > > Given the fork() approach from the unit test, and the fact that > > > the double-free check is on an ordinary variable, causes multiple > > > child processed (fork()-ed from the unit-test runner) to attempt > > > to free the huge-page memory multiple times. The variable to > > > protect against double-cleanup was not effective, as the fork() > > > would restore it to show initialized in the next child. > > > > > > The solution is to call rte_service_finalize() *before* calling > > > fork(), which results in the service cores double-cleanup variable > > > to be zero before the fork(), and hence the child processes never > > > free the hugepage service-cores memory (correct behavior, as the > > > unit-test suite is still running, and owns the hugepages). > > > > Ok, you fixed it in UT, but what to do other apps that use fork()? > > Let say our examples/multi_process/l2fwd_fork uses fork() to > > spawn child processes instead of threads. > > Might be some generic way is needed: let say at fork time setup some > > global to indicate that it is a child process and it shouldn't call > rte_finalize() or so. > > Konstantin Valid concerns, the issue gets complex when we mix shared resources and fork() multiple processes, threads etc. > At first, we should discuss whether it is a good idea to support fork, > given that we have the "secondary process solution". >=20 > Then, if an improvement is needed, it should go in 18.05. > I think the fix in UT is good enough for 18.02. Agreed, and I'd prefer not rush changes here given the complexity and multitude of use-cases.