dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mem: add write memory barrier before changing heap state
@ 2014-04-15 13:50 David Marchand
       [not found] ` <1397569859-14460-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: David Marchand @ 2014-04-15 13:50 UTC (permalink / raw)
  To: dev-VfR2kkLFssw

From: Didier Pallard <didier.pallard-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>

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 <didier.pallard-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
---
 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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-04-30  9:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-15 13:50 [PATCH 1/2] mem: add write memory barrier before changing heap state David Marchand
     [not found] ` <1397569859-14460-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-04-15 13:50   ` [PATCH 2/2] mem: fix initialization check for malloc heap David Marchand
2014-04-15 14:08   ` [PATCH 1/2] mem: add write memory barrier before changing heap state Richardson, Bruce
     [not found]     ` <59AF69C657FD0841A61C55336867B5B01A9FCCFF-kPTMFJFq+rELt2AQoY/u9bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-04-16  8:55       ` didier.pallard
2014-04-15 14:44   ` Neil Horman
     [not found]     ` <20140415144440.GD3557-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2014-04-18 12:56       ` [PATCH 0/2] rework heap initialisation David Marchand
     [not found]         ` <1397825778-24334-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-04-18 12:56           ` [PATCH 1/2] malloc: get rid of numa_socket field David Marchand
     [not found]             ` <1397825778-24334-2-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-04-18 13:08               ` Neil Horman
     [not found]                 ` <20140418130842.GA4053-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-04-30  9:46                   ` Thomas Monjalon
2014-04-18 12:56           ` [PATCH 2/2] malloc: simplify heap initialisation David Marchand
     [not found]             ` <1397825778-24334-3-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-04-18 13:09               ` Neil Horman
     [not found]                 ` <20140418130919.GB4053-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-04-30  9:47                   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).