From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Marchand Subject: [PATCH 1/2] mem: add write memory barrier before changing heap state Date: Tue, 15 Apr 2014 15:50:58 +0200 Message-ID: <1397569859-14460-1-git-send-email-david.marchand@6wind.com> To: dev-VfR2kkLFssw@public.gmane.org Return-path: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" From: Didier Pallard a write memory barrier is needed before changing heap state value, else some concurrent core may see state changing before all initialization values are written to memory, causing unpredictable results in malloc function. Signed-off-by: Didier Pallard --- lib/librte_malloc/malloc_heap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_malloc/malloc_heap.c b/lib/librte_malloc/malloc_heap.c index f4a0294..64668cb 100644 --- a/lib/librte_malloc/malloc_heap.c +++ b/lib/librte_malloc/malloc_heap.c @@ -147,6 +147,7 @@ malloc_heap_init(struct malloc_heap *heap) */ heap->numa_socket = heap - mcfg->malloc_heaps; rte_spinlock_init(&heap->lock); + rte_wmb(); heap->initialised = INITIALISED; } } -- 1.7.10.4