[dpdk-users] [dpdk-dev] rte_zmalloc() returning non-zeroed memory on FreeBSD
Harris, James R
james.r.harris at intel.com
Mon Aug 15 19:23:27 CEST 2016
> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Thursday, August 11, 2016 12:05 AM
> To: users at dpdk.org; dev at dpdk.org; Gonzalez Monroy, Sergio; Richardson,
> Cc: Verkamp, Daniel
> Subject: Re: [dpdk-dev] [dpdk-users] rte_zmalloc() returning non-zeroed
> memory on FreeBSD
> 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:
> > not zero out memory on zmalloc") removed the explicit memset() that
> > 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.
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.
More information about the users