From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 0759E2C60; Mon, 15 Aug 2016 19:23:28 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 15 Aug 2016 10:23:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,526,1464678000"; d="scan'208";a="1025782642" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga001.fm.intel.com with ESMTP; 15 Aug 2016 10:23:27 -0700 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 15 Aug 2016 10:23:27 -0700 Received: from fmsmsx105.amr.corp.intel.com ([169.254.4.83]) by FMSMSX102.amr.corp.intel.com ([10.18.124.200]) with mapi id 14.03.0248.002; Mon, 15 Aug 2016 10:23:27 -0700 From: "Harris, James R" To: Thomas Monjalon , "users@dpdk.org" , "dev@dpdk.org" , "Gonzalez Monroy, Sergio" , "Richardson, Bruce" CC: "Verkamp, Daniel" Thread-Topic: [dpdk-dev] [dpdk-users] rte_zmalloc() returning non-zeroed memory on FreeBSD Thread-Index: AQHR857XBz9ny2K4OEiikd7MDMvyt6BKS12A Date: Mon, 15 Aug 2016 17:23:27 +0000 Message-ID: References: <1470871839.40000.48.camel@intel.com> <1549431.MJntLMElOg@xps13> In-Reply-To: <1549431.MJntLMElOg@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.1.200.108] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [dpdk-users] rte_zmalloc() returning non-zeroed memory on FreeBSD 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: Mon, 15 Aug 2016 17:23:29 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon > Sent: Thursday, August 11, 2016 12:05 AM > To: users@dpdk.org; dev@dpdk.org; Gonzalez Monroy, Sergio; Richardson, > Bruce > Cc: Verkamp, Daniel > Subject: Re: [dpdk-dev] [dpdk-users] rte_zmalloc() returning non-zeroed > memory on FreeBSD >=20 > Hi, >=20 > 2016-08-10 23:30, Verkamp, Daniel: > > It seems that with DPDK 16.07, rte_zmalloc() and related functions no > > longer return zeroed memory reliably on FreeBSD. > > > > I notice that commit b78c9175118f7d61022ddc5c62ce54a1bd73cea5 ("mem: > do > > not zero out memory on zmalloc") removed the explicit memset() that > used > > to ensure the buffer was zeroed; its log message says: > > > > "Zeroing out memory on rte_zmalloc_socket is not required anymore since > > all allocated memory is already zeroed." >=20 > On Linux, the memory is zeroed by the kernel. > Then the zero value is maintained in the rte_malloc pool by rte_free. >=20 > > However, I don't see how this is guaranteed (at least for FreeBSD), and > > it is not true in practice. I've attached a minimized reproducer progr= am - > > running it twice in a row fails reliably for me. > > > > Is there a missing step in FreeBSD, or is it a more general problem for > > other platforms? >=20 > I guess the initial value from the kernel has been verified only on Linux= . > We could re-add a memset for FreeBSD. The problem is that the FreeBSD contigmem driver does not re-zero the huge pages each time they are mmap'd - they are only zeroed when contigmem initially loads. I will push a patch for this shortly.