DPDK patches and discussions
 help / color / mirror / Atom feed
From: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, bruce.richardson@intel.com,
	Darek Stojaczyk <dariusz.stojaczyk@intel.com>,
	Qi Zhang <qi.z.zhang@intel.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2] eal: initialize alarms early
Date: Mon,  1 Apr 2019 16:18:14 +0200	[thread overview]
Message-ID: <20190401141814.8096-1-dariusz.stojaczyk@intel.com> (raw)
In-Reply-To: <20190326184331.13850-1-dariusz.stojaczyk@intel.com>

On linux, we currently initialize rte_alarms after
starting to listen for IPC hotplug requests, which gives
us a data race window. Upon receiving such hotplug
request we always try to set an alarm and this obviously
doesn't work if the alarms weren't initialized yet.

To fix it, we initialize alarms before starting to
listen for IPC hotplug messages. Specifically, we move
rte_eal_alarm_init() right after rte_eal_intr_init() as
it makes some sense to keep those two close to each other.

We update the bsd code as well to keep the initialization
order the same in both eal implementations.

Fixes: 244d5130719c ("eal: enable hotplug on multi-process")
Cc: Qi Zhang <qi.z.zhang@intel.com>
Cc: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: stable@dpdk.org

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
---
v2:
 - updated the bsd code as well (Thomas)


 lib/librte_eal/freebsd/eal/eal.c | 12 ++++++------
 lib/librte_eal/linux/eal/eal.c   | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c
index 4e86b10b1..790c6afa7 100644
--- a/lib/librte_eal/freebsd/eal/eal.c
+++ b/lib/librte_eal/freebsd/eal/eal.c
@@ -662,6 +662,12 @@ rte_eal_init(int argc, char **argv)
 		return -1;
 	}
 
+	if (rte_eal_alarm_init() < 0) {
+		rte_eal_init_alert("Cannot init interrupt-handling thread");
+		/* rte_eal_alarm_init sets rte_errno on failure. */
+		return -1;
+	}
+
 	/* Put mp channel init before bus scan so that we can init the vdev
 	 * bus through mp channel in the secondary process before the bus scan.
 	 */
@@ -751,12 +757,6 @@ rte_eal_init(int argc, char **argv)
 		return -1;
 	}
 
-	if (rte_eal_alarm_init() < 0) {
-		rte_eal_init_alert("Cannot init interrupt-handling thread");
-		/* rte_eal_alarm_init sets rte_errno on failure. */
-		return -1;
-	}
-
 	if (rte_eal_timer_init() < 0) {
 		rte_eal_init_alert("Cannot init HPET or TSC timers");
 		rte_errno = ENOTSUP;
diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index 13f401684..75ed0cf10 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -1005,6 +1005,12 @@ rte_eal_init(int argc, char **argv)
 		return -1;
 	}
 
+	if (rte_eal_alarm_init() < 0) {
+		rte_eal_init_alert("Cannot init interrupt-handling thread");
+		/* rte_eal_alarm_init sets rte_errno on failure. */
+		return -1;
+	}
+
 	/* Put mp channel init before bus scan so that we can init the vdev
 	 * bus through mp channel in the secondary process before the bus scan.
 	 */
@@ -1125,12 +1131,6 @@ rte_eal_init(int argc, char **argv)
 		return -1;
 	}
 
-	if (rte_eal_alarm_init() < 0) {
-		rte_eal_init_alert("Cannot init interrupt-handling thread");
-		/* rte_eal_alarm_init sets rte_errno on failure. */
-		return -1;
-	}
-
 	if (rte_eal_timer_init() < 0) {
 		rte_eal_init_alert("Cannot init HPET or TSC timers");
 		rte_errno = ENOTSUP;
-- 
2.17.1

  parent reply	other threads:[~2019-04-01 14:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-26 18:43 [dpdk-dev] [PATCH] " Darek Stojaczyk
2019-03-26 18:43 ` Darek Stojaczyk
2019-03-27 18:11 ` Thomas Monjalon
2019-03-27 18:11   ` Thomas Monjalon
2019-03-27 20:33   ` Stojaczyk, Dariusz
2019-03-27 20:33     ` Stojaczyk, Dariusz
2019-03-27 22:42     ` Thomas Monjalon
2019-03-27 22:42       ` Thomas Monjalon
2019-03-28 10:43       ` Bruce Richardson
2019-03-28 10:43         ` Bruce Richardson
2019-03-28 10:46         ` Thomas Monjalon
2019-03-28 10:46           ` Thomas Monjalon
2019-03-28 13:14           ` Burakov, Anatoly
2019-03-28 13:14             ` Burakov, Anatoly
2019-04-01 14:22     ` Stojaczyk, Dariusz
2019-04-01 14:22       ` Stojaczyk, Dariusz
2019-04-01 14:18 ` Darek Stojaczyk [this message]
2019-04-01 14:18   ` [dpdk-dev] [PATCH v2] " Darek Stojaczyk
2019-04-02 13:01   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2019-04-02 13:01     ` Thomas Monjalon

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=20190401141814.8096-1-dariusz.stojaczyk@intel.com \
    --to=dariusz.stojaczyk@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /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).