From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A7A01A0613 for ; Wed, 28 Aug 2019 11:01:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 911B41C1BA; Wed, 28 Aug 2019 11:01:19 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 6DCA31C1B8 for ; Wed, 28 Aug 2019 11:01:17 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Aug 2019 02:01:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,440,1559545200"; d="scan'208";a="183063193" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.108]) ([10.237.220.108]) by orsmga003.jf.intel.com with ESMTP; 28 Aug 2019 02:01:15 -0700 To: Bruce Richardson Cc: Jim Harris , dev@dpdk.org References: <156646334762.14099.13593080473257757748.stgit@jrharri1-skx> <156682708634.28714.543470193614987025.stgit@jrharri1-skx> <20190827124851.GA591@bricha3-MOBL.ger.corp.intel.com> From: "Burakov, Anatoly" Message-ID: <1ca9c84a-811f-a63c-86f1-4a9325ddc393@intel.com> Date: Wed, 28 Aug 2019 10:01:12 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190827124851.GA591@bricha3-MOBL.ger.corp.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v5] eal: use memzone to share tsc hz with secondary processes 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 27-Aug-19 1:48 PM, Bruce Richardson wrote: > On Tue, Aug 27, 2019 at 01:04:18PM +0100, Burakov, Anatoly wrote: >> On 26-Aug-19 2:44 PM, Jim Harris wrote: >>> Ideally, get_tsc_freq_arch() is able to provide the >>> TSC rate using arch-specific means. When that is not >>> possible, DPDK reverts to calculating the TSC rate with >>> a 100ms nanosleep or 1s sleep. The latter occurs more >>> frequently in VMs which often do not have access to the >>> data they need from arch-specific means (CPUID leaf 0x15 >>> or MSR 0xCE on x86). >>> >>> In secondary processes, the extra 100ms is especially >>> noticeable and consumes the bulk of rte_eal_init() >>> execution time. To resolve this extra delay, have >>> the primary process put the TSC rate into a shared >>> memory region that the secondary process can lookup. >>> >>> Reduces rte_eal_init() execution time in a secondary >>> process from 165ms to 66ms on my test system. >>> >>> Signed-off-by: Jim Harris >>> --- >> >> I think this is a bad idea. If you're allocating something, you're supposed >> to free it in rte_eal_cleanup(). If you don't, that memory leaks (i.e. there >> are leftover hugepages after process exit). Since both primary and secondary >> are referencing it (even if only at init), there is no safe way to free this >> memzone. >> > What is the issue with not freeing it? How do we handle this for other > global data to be shared? > I don't think we have any shared data that persists after process exit. Or at least not in EAL we don't - i'm aware that some drivers leak memory in that way, but that's on them, not on me :) The immediate consequence of such an approach is failed EAL flags unit tests (because they expect that nothing is left after DPDK process termination). Most shared data in libraries is explicitly initialized/deinitialized by the library user, so it's not an issue. An exception to that is the timer library, which uses refcounting to initialize/deinitialize shared state. -- Thanks, Anatoly