DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jean Tourrilhes <jt@labs.hpe.com>
To: Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: dev@dpdk.org, David Marchand <david.marchand@6wind.com>,
	Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>,
	olivier.matz@6wind.com, David Hunt <david.hunt@intel.com>
Subject: [dpdk-dev] [PATCH v2] eal: don't fail secondary if primary is missing tailqs
Date: Wed, 5 Oct 2016 10:47:34 -0700	[thread overview]
Message-ID: <20161005174734.GC12182@labs.hpe.com> (raw)
In-Reply-To: <7491622.GqnA43pcBO@xps13>

If the primary and secondary process were build using different build
systems, the list of constructors included by the linker in each
binary might be different. Tailqs are registered via constructors, so
the linker magic will directly impact which tailqs are registered with
the primary and the secondary.

DPDK currently assumes that the secondary has a subset of the tailqs
registered at the primary. In some build scenario, the secondary might
register a tailq that the primary did not register. In this case,
instead of exiting with a panic, just unregister the offending tailq
and allow the secondary to run.

Signed-off-by: Jean Tourrilhes <jt@labs.hpe.com>
---
 lib/librte_eal/common/eal_common_tailqs.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_tailqs.c b/lib/librte_eal/common/eal_common_tailqs.c
index bb08ec8..cf5a771 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++;
 	}
 }
 
@@ -178,19 +180,27 @@ int
 rte_eal_tailqs_init(void)
 {
 	struct rte_tailq_elem *t;
+	void *tmp_te;
 
 	rte_tailqs_count = 0;
 
-	TAILQ_FOREACH(t, &rte_tailq_elem_head, next) {
+	TAILQ_FOREACH_SAFE(t, &rte_tailq_elem_head, next, tmp_te) {
 		/* second part of register job for "early" tailqs, see
 		 * rte_eal_tailq_register and EAL_REGISTER_TAILQ */
 		rte_eal_tailq_update(t);
 		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);
+			}
 		}
 	}
 

  parent reply	other threads:[~2016-10-05 17:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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             ` Jean Tourrilhes [this message]
2018-12-21 15:50               ` [dpdk-dev] [PATCH v2] eal: don't " Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161005174734.GC12182@labs.hpe.com \
    --to=jt@labs.hpe.com \
    --cc=david.hunt@intel.com \
    --cc=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    --cc=jean.tourrilhes@hpe.com \
    --cc=olivier.matz@6wind.com \
    --cc=sergio.gonzalez.monroy@intel.com \
    --cc=thomas.monjalon@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).