From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [dpdk-users] rte_zmalloc() returning non-zeroed memory on FreeBSD Date: Thu, 11 Aug 2016 09:05:25 +0200 Message-ID: <1549431.MJntLMElOg@xps13> References: <1470871839.40000.48.camel@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: "Verkamp, Daniel" To: users@dpdk.org, dev@dpdk.org, "Gonzalez Monroy, Sergio" , bruce.richardson@intel.com Return-path: Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by dpdk.org (Postfix) with ESMTP id 7188C2C31 for ; Thu, 11 Aug 2016 09:05:27 +0200 (CEST) Received: by mail-wm0-f46.google.com with SMTP id o80so13796375wme.1 for ; Thu, 11 Aug 2016 00:05:27 -0700 (PDT) In-Reply-To: <1470871839.40000.48.camel@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, 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." On Linux, the memory is zeroed by the kernel. Then the zero value is maintained in the rte_malloc pool by rte_free. > 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 program - > 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? I guess the initial value from the kernel has been verified only on Linux. We could re-add a memset for FreeBSD.