[dpdk-dev] [PATCH 1/1] eal: Don't fail secondary if primary is missing tailqs

Burdick, Cliff Cliff.Burdick at viasat.com
Tue Nov 13 00:33:01 CET 2018


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 at viasat.com<mailto:cliff.burdick at 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);
+                      }
              }
       }



More information about the dev mailing list