DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [Bug] Static constructors considered evil
@ 2016-09-22 20:46 Jean Tourrilhes
  2016-09-22 21:17 ` [dpdk-dev] [PATCH 1/1] eal: Don't fail secondary if primary is missing tailqs Jean Tourrilhes
  0 siblings, 1 reply; 35+ messages in thread
From: Jean Tourrilhes @ 2016-09-22 20:46 UTC (permalink / raw)
  To: dev

	Hi,

	Expecting static constructors to match between the primary and
the secondary is ill advised and putting yourself at the mercy of the
linker magic. In this case, both primary and secondary were compiled
using the same DPDK directory and exact same libdpdk.a.

Config :
------
CONFIG_RTE_LIBRTE_HASH=y
CONFIG_RTE_LIBRTE_LPM=y
CONFIG_RTE_LIBRTE_ACL=y
CONFIG_RTE_LIBRTE_DISTRIBUTOR=y
CONFIG_RTE_LIBRTE_REORDER=y

Primary :
-------
EAL: Registered tailq: RTE_ACL
EAL: Registered tailq: RTE_HASH
EAL: Registered tailq: RTE_FBK_HASH
EAL: Registered tailq: RTE_MEMPOOL
EAL: Registered tailq: RTE_RING
EAL: Registered tailq: VFIO_RESOURCE_LIST
EAL: Registered tailq: UIO_RESOURCE_LIST
Tailq 0: qname:<RTE_ACL>, tqh_first:(nil), tqh_last:0x7feffffff41c
Tailq 1: qname:<RTE_HASH>, tqh_first:(nil), tqh_last:0x7feffffff44c
Tailq 2: qname:<RTE_FBK_HASH>, tqh_first:(nil), tqh_last:0x7feffffff47c
Tailq 3: qname:<RTE_MEMPOOL>, tqh_first:(nil), tqh_last:0x7feffffff4ac
Tailq 4: qname:<RTE_RING>, tqh_first:(nil), tqh_last:0x7feffffff4dc
Tailq 5: qname:<VFIO_RESOURCE_LIST>, tqh_first:(nil), tqh_last:0x7feffffff50c
Tailq 6: qname:<UIO_RESOURCE_LIST>, tqh_first:(nil), tqh_last:0x7feffffff53c
Tailq 7: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 8: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 9: qname:<>, tqh_first:(nil), tqh_last:(nil)

Secondary :
---------
EAL: Registered tailq: RTE_LPM
EAL: Registered tailq: RTE_LPM6
EAL: Registered tailq: RTE_HASH
EAL: Registered tailq: RTE_FBK_HASH
EAL: Registered tailq: RTE_ACL
EAL: Registered tailq: RTE_REORDER
EAL: Registered tailq: VFIO_RESOURCE_LIST
EAL: Registered tailq: UIO_RESOURCE_LIST
EAL: Registered tailq: RTE_DISTRIBUTOR
EAL: Registered tailq: RTE_MEMPOOL
EAL: Registered tailq: RTE_RING
EAL: Cannot initialize tailq: RTE_LPM
Tailq 0: qname:<RTE_ACL>, tqh_first:(nil), tqh_last:0x7feffffff41c
Tailq 1: qname:<RTE_HASH>, tqh_first:0x7ff0004c62c0, tqh_last:0x7ff0004c62c0
Tailq 2: qname:<RTE_FBK_HASH>, tqh_first:(nil), tqh_last:0x7feffffff47c
Tailq 3: qname:<RTE_MEMPOOL>, tqh_first:0x7ff0004a81c0, tqh_last:0x7ff0004a8040
Tailq 4: qname:<RTE_RING>, tqh_first:0x7ff0004a8140, tqh_last:0x7ff0004c6340
Tailq 5: qname:<VFIO_RESOURCE_LIST>, tqh_first:0x7ff0005fee80, tqh_last:0x7ff00052be80
Tailq 6: qname:<UIO_RESOURCE_LIST>, tqh_first:(nil), tqh_last:0x7feffffff53c
Tailq 7: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 8: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 9: qname:<>, tqh_first:(nil), tqh_last:(nil)
[...]
PANIC in rte_eal_init():
Cannot init tail queues for objects

	Obviously not happy...
	Any advices ?

	Jean

^ permalink raw reply	[flat|nested] 35+ messages in thread
* [dpdk-dev] [PATCH 1/1] eal: Don't fail secondary if primary is missing tailqs
@ 2018-11-12 23:33 Burdick, Cliff
  2018-11-13  9:21 ` Thomas Monjalon
  0 siblings, 1 reply; 35+ messages in thread
From: Burdick, Cliff @ 2018-11-12 23:33 UTC (permalink / raw)
  To: dev

This patch was submitted by Jean Tourrilhes over two years ago, but didn't receive any responses. I hit the same issue recently when trying to use cgo (Golang) as a primary process linked to libdpdk.a against a C++ application linked against the same library. The history of the patch is here:

https://dev.dpdk.narkive.com/ZM3a7QD1/dpdk-dev-bug-static-constructors-considered-evil

and the original patch is here:

http://mails.dpdk.org/archives/dev/2016-September/047332.html

Can someone please give this another look? I don't see any other way to do a workaround short of applying this patch.


Signed-off-by: Cliff Burdick cliff.burdick@viasat.com<mailto:cliff.burdick@viasat.com>

---
lib/librte_eal/common/eal_common_tailqs.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_tailqs.c b/lib/librte_eal/common/eal_common_tailqs.c
index bb08ec8..6960d06 100644
--- a/lib/librte_eal/common/eal_common_tailqs.c
+++ b/lib/librte_eal/common/eal_common_tailqs.c
@@ -143,6 +143,8 @@ rte_eal_tailq_update(struct rte_tailq_elem *t)
              t->head = rte_eal_tailq_create(t->name);
       } else {
              t->head = rte_eal_tailq_lookup(t->name);
+              if (t->head != NULL)
+                      rte_tailqs_count++;
       }
}
@@ -188,9 +190,16 @@ rte_eal_tailqs_init(void)
              if (t->head == NULL) {
                      RTE_LOG(ERR, EAL,
                              "Cannot initialize tailq: %s\n", t->name);
-                      /* no need to TAILQ_REMOVE, we are going to panic in
-                      * rte_eal_init() */
-                      goto fail;
+                      if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+                              /* no need to TAILQ_REMOVE, we are going
+                              * to panic in rte_eal_init() */
+                              goto fail;
+                      } else {
+                              /* This means our list of constructor is
+                              * no the same as primary. Just remove
+                              * that missing tailq and continue */
+                              TAILQ_REMOVE(&rte_tailq_elem_head, t, next);
+                      }
              }
       }

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

end of thread, other threads:[~2018-12-21 15:50 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22 20:46 [dpdk-dev] [Bug] Static constructors considered evil Jean Tourrilhes
2016-09-22 21:17 ` [dpdk-dev] [PATCH 1/1] eal: Don't fail secondary if primary is missing tailqs Jean Tourrilhes
2016-10-04 13:11   ` Sergio Gonzalez Monroy
2016-10-04 16:59     ` Jean Tourrilhes
2016-10-05  7:58       ` David Marchand
2016-10-05 16:49         ` Jean Tourrilhes
2016-10-05 17:09           ` Thomas Monjalon
2016-10-05 17:34             ` Jean Tourrilhes
2016-10-05 17:47             ` [dpdk-dev] [PATCH v2] eal: don't " Jean Tourrilhes
2018-12-21 15:50               ` Ferruh Yigit
2018-11-12 23:33 [dpdk-dev] [PATCH 1/1] eal: Don't " Burdick, Cliff
2018-11-13  9:21 ` Thomas Monjalon
2018-11-13  9:39   ` Burakov, Anatoly
2018-11-13 15:45     ` Burdick, Cliff
2018-11-13 16:06       ` Thomas Monjalon
2018-11-13 16:38         ` Burdick, Cliff
2018-11-13 16:44           ` Thomas Monjalon
2018-11-13 22:08             ` Burdick, Cliff
2018-11-13 22:18               ` Thomas Monjalon
2018-11-13 23:42                 ` Burdick, Cliff
2018-11-14 11:47                   ` Bruce Richardson
2018-11-14 17:40                     ` Burdick, Cliff
2018-11-14 18:15                       ` Luca Boccassi
2018-11-14 18:24                         ` Burdick, Cliff
2018-11-15  9:33                           ` Luca Boccassi
2018-11-15 16:15                             ` Burdick, Cliff
2018-11-15 16:41                               ` Bruce Richardson
2018-11-15 16:55                                 ` Burdick, Cliff
2018-11-15 17:01                                   ` Richardson, Bruce
2018-11-15 17:05                                     ` Luca Boccassi
2018-11-15 17:17                                       ` Bruce Richardson
2018-11-15 17:36                                         ` Burdick, Cliff
2018-11-16 10:22                                           ` Bruce Richardson
2018-11-15 18:22                                         ` Luca Boccassi
2018-11-16 10:23                                           ` Bruce Richardson

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).