From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 51880F72; Mon, 8 May 2017 10:10:45 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP; 08 May 2017 01:10:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,308,1491289200"; d="scan'208";a="84821415" Received: from unknown (HELO localhost.localdomain) ([10.239.129.160]) by orsmga004.jf.intel.com with ESMTP; 08 May 2017 01:10:43 -0700 From: Tiwei Bie To: dev@dpdk.org Cc: bruce.richardson@intel.com, stable@dpdk.org Date: Mon, 8 May 2017 08:09:16 +0000 Message-Id: <20170508080916.4317-1-tiwei.bie@intel.com> X-Mailer: git-send-email 2.12.1 Subject: [dpdk-stable] [PATCH] eal/bsd: don't zero the pages during mmap in contigmem X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 May 2017 08:10:47 -0000 Don't zero the pages during mmap in contigmem. Instead, zero the pages after mmap in primary process. Otherwise, the multi-process support will be broken, as the pages will be zeroed when secondary processes map the memory. Fixes: 82f931805506 ("contigmem: zero all pages during mmap") Cc: stable@dpdk.org Signed-off-by: Tiwei Bie --- lib/librte_eal/bsdapp/contigmem/contigmem.c | 1 - lib/librte_eal/bsdapp/eal/eal_memory.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/bsdapp/contigmem/contigmem.c b/lib/librte_eal/bsdapp/contigmem/contigmem.c index da971debe..3826055f7 100644 --- a/lib/librte_eal/bsdapp/contigmem/contigmem.c +++ b/lib/librte_eal/bsdapp/contigmem/contigmem.c @@ -227,7 +227,6 @@ contigmem_mmap_single(struct cdev *cdev, vm_ooffset_t *offset, vm_size_t size, if (buffer_index >= contigmem_num_buffers) return EINVAL; - memset(contigmem_buffers[buffer_index], 0, contigmem_buffer_size); *offset = (vm_ooffset_t)vtophys(contigmem_buffers[buffer_index]); *obj = vm_pager_allocate(OBJT_DEVICE, cdev, size, nprot, *offset, curthread->td_ucred); diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c b/lib/librte_eal/bsdapp/eal/eal_memory.c index 3614da8db..a2809d66a 100644 --- a/lib/librte_eal/bsdapp/eal/eal_memory.c +++ b/lib/librte_eal/bsdapp/eal/eal_memory.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -121,6 +122,8 @@ rte_eal_hugepage_init(void) seg->nrank = mcfg->nrank; seg->socket_id = 0; + memset(seg->addr, 0, seg->len); + RTE_LOG(INFO, EAL, "Mapped memory segment %u @ %p: physaddr:0x%" PRIx64", len %zu\n", seg_idx, addr, physaddr, hpi->hugepage_sz); -- 2.12.1