From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 00DB98DA9 for ; Thu, 19 Nov 2015 10:14:54 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 19 Nov 2015 01:14:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,317,1444719600"; d="scan'208";a="854635045" Received: from smonroyx-mobl.ger.corp.intel.com (HELO [10.237.221.29]) ([10.237.221.29]) by fmsmga002.fm.intel.com with ESMTP; 19 Nov 2015 01:14:52 -0800 To: "Xie, Huawei" , "Wang, Zhihong" , "Mcnamara, John" , "dev@dpdk.org" References: <1447817231-10510-1-git-send-email-zhihong.wang@intel.com> <1447817231-10510-3-git-send-email-zhihong.wang@intel.com> <8F6C2BD409508844A0EFC19955BE094183467C@SHSMSX152.ccr.corp.intel.com> From: Sergio Gonzalez Monroy Message-ID: <564D930C.7060108@intel.com> Date: Thu, 19 Nov 2015 09:14:52 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [RFC PATCH 2/2] lib/librte_eal: Remove unnecessary hugepage zero-filling X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Nov 2015 09:14:55 -0000 On 18/11/2015 12:07, Xie, Huawei wrote: > On 11/18/2015 6:45 PM, Wang, Zhihong wrote: >>> -----Original Message----- >>> From: Mcnamara, John >>> Sent: Wednesday, November 18, 2015 6:40 PM >>> To: Wang, Zhihong ; dev@dpdk.org >>> Subject: RE: [dpdk-dev] [RFC PATCH 2/2] lib/librte_eal: Remove unnecessary >>> hugepage zero-filling >>> >>> >>> >>>> -----Original Message----- >>>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhihong Wang >>>> Sent: Wednesday, November 18, 2015 3:27 AM >>>> To: dev@dpdk.org >>>> Subject: [dpdk-dev] [RFC PATCH 2/2] lib/librte_eal: Remove unnecessary >>>> hugepage zero-filling >>>> >>>> The kernel fills new allocated (huge) pages with zeros. >>>> DPDK just has to touch the pages to trigger the allocation. > I think we shouldn't reply on the assumption that kernel has zeroed the > memory. Kernel zeroes the memory mostly to avoid information leakage.It > could also achieve this by setting each bit to 1. > What we indeed need to check is later DPDK initialization code doesn't > assume the memory has been zeroed. Otherwise zero only that part of the > memory. Does this makes sense? Why cannot we rely on the kernel zeroing the memory ? If that behavior were to change, then we can zero out the memory ourselves. Bruce pointed out to me that the semantics have changed a bit since we introduced rte_memzone_free. Before that, all memzone reserve were zero out by default. Is there code relying on that? I'm not sure, but it still is good practice to do it. I submitted an RFC regarding this: http://dpdk.org/ml/archives/dev/2015-November/028416.html The idea would be to keep the available memory we are managing zeroed at all times. Sergio >>>> ... >>>> if (orig) { >>>> hugepg_tbl[i].orig_va = virtaddr; >>>> - memset(virtaddr, 0, hugepage_sz); >>>> + memset(virtaddr, 0, 8); >>>> } >>> Probably worth adding a one or two line comment here to avoid someone >>> thinking that it is a bug at some later stage. The text in the commit message >>> above is suitable. >>> >> Good suggestion! Will add it :) >> >>> John. >>> --