From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 20AD01B7BE for ; Wed, 31 Jan 2018 15:32:29 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id C66BF20D46; Wed, 31 Jan 2018 09:32:28 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 31 Jan 2018 09:32:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=kl3aNyKaQI+u6IhirWyto6YLPa NLiZPi768gmurcv3g=; b=WIloMigAryNSKp65MgrNkfI907dxdKHLlVXRtSSCJ+ i9tm23mYeQE2xZ+3CCkOLEP2q2BqXJcHahAtSuhqIdO0DZzrWpVJ78+LvMYH7lAo HBwQAhbxErbnl7qEcMMgHpg/eOzb4N8csurG8xyJU5B2zTS15Xwecud1/vrQaxK4 s= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=kl3aNy KaQI+u6IhirWyto6YLPaNLiZPi768gmurcv3g=; b=fCbt/AX2XHq0TSnPgLW/ae pe839juExZSwL6bgOfazGd8UUDkqDDlDDvocPzz2FygJ9f0ukWpHm3sGR0BIDjwG FUQiEDQki71a2RswwaqIgQFIKK7LFgcBdujdoQdFk/KmVuiFg5Mcv1WQxqDP1YTw iqqf2ecvyBCq9aQ0/gjli9ZsppWWkASP3OBi5lk6kOVThSNXVoLhlmN9DkUIQ9Qt TPM1APIqSJXc1lq1PcUe3ddJusDMTvLHfGu+V5Cztve/xJKnlRw20ZTDbYTVKI9X 5UclSCPBQRYLyGwt3o7lVp8bknaET7RyqWRtTWKqplr+QcxC9ZAoZ5pDaDHnZZyA == X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 775917E1DE; Wed, 31 Jan 2018 09:32:28 -0500 (EST) From: Thomas Monjalon To: "Ananyev, Konstantin" , "Van Haaren, Harry" Cc: "dev@dpdk.org" , "pbhagavatula@caviumnetworks.com" Date: Wed, 31 Jan 2018 15:31:41 +0100 Message-ID: <10693804.qgnIZzW71k@xps> In-Reply-To: <2601191342CEEE43887BDE71AB977258905663C3@IRSMSX103.ger.corp.intel.com> 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> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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:32:29 -0000 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 At first, we should discuss whether it is a good idea to support fork, given that we have the "secondary process solution". Then, if an improvement is needed, it should go in 18.05. I think the fix in UT is good enough for 18.02.