dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] eal: fix vdev allocation on non-0 numa socket
@ 2014-04-30 13:15 David Marchand
       [not found] ` <1398863708-31078-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: David Marchand @ 2014-04-30 13:15 UTC (permalink / raw)
  To: dev-VfR2kkLFssw

From: Maxime Leroy <maxime.leroy-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>

vdev ethdev can not be allocated on a numa socket that is not socket 0.
The reason comes from rte_eth_dev_allocate() which uses rte_socket_id() to
identify the socket on which vdev driver data should be allocated.
However, at this initialization step, rte_socket_id() always returns 0.

Looking at rte_socket_id(), it needs rte_lcore_id() which uses the per-core
global _lcore_id variable. This variable is initialised by
eal_thread_init_master.

So eal_thread_init_master should be called before rte_eal_vdev_init().

Signed-off-by: Maxime Leroy <maxime.leroy-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
---
 lib/librte_eal/linuxapp/eal/eal.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index b7f5ffa..d7a59de 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -1056,12 +1056,14 @@ rte_eal_init(int argc, char **argv)
 			RTE_LOG(WARNING, EAL, "%s\n", dlerror());
 	}
 
-	if (rte_eal_vdev_init() < 0)
-		rte_panic("Cannot init virtual devices\n");
+	eal_thread_init_master(rte_config.master_lcore);
 
 	RTE_LOG(DEBUG, EAL, "Master core %u is ready (tid=%x)\n",
 		rte_config.master_lcore, (int)thread_id);
 
+	if (rte_eal_vdev_init() < 0)
+		rte_panic("Cannot init virtual devices\n");
+
 	RTE_LCORE_FOREACH_SLAVE(i) {
 
 		/*
@@ -1082,8 +1084,6 @@ rte_eal_init(int argc, char **argv)
 			rte_panic("Cannot create thread\n");
 	}
 
-	eal_thread_init_master(rte_config.master_lcore);
-
 	/*
 	 * Launch a dummy function on all slave lcores, so that master lcore
 	 * knows they are all ready when this function returns.
-- 
1.7.10.4

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

* Re: [PATCH] eal: fix vdev allocation on non-0 numa socket
       [not found] ` <1398863708-31078-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
@ 2014-04-30 21:16   ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2014-04-30 21:16 UTC (permalink / raw)
  To: maxime.leroy-pdR9zngts4EAvxtiuMwx3w; +Cc: dev-VfR2kkLFssw

> From: Maxime Leroy <maxime.leroy-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
> 
> vdev ethdev can not be allocated on a numa socket that is not socket 0.
> The reason comes from rte_eth_dev_allocate() which uses rte_socket_id() to
> identify the socket on which vdev driver data should be allocated.
> However, at this initialization step, rte_socket_id() always returns 0.
> 
> Looking at rte_socket_id(), it needs rte_lcore_id() which uses the per-core
> global _lcore_id variable. This variable is initialised by
> eal_thread_init_master.
> 
> So eal_thread_init_master should be called before rte_eal_vdev_init().
> 
> Signed-off-by: Maxime Leroy <maxime.leroy-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>

Acked-by: Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>

Applied for version 1.6.0r2.

Thanks
-- 
Thomas

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-30 13:15 [PATCH] eal: fix vdev allocation on non-0 numa socket David Marchand
     [not found] ` <1398863708-31078-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-04-30 21:16   ` 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).