From mboxrd@z Thu Jan 1 00:00:00 1970 From: Darek Stojaczyk Subject: [PATCH] eal: initialize alarms early Date: Tue, 26 Mar 2019 19:43:31 +0100 Message-ID: <20190326184331.13850-1-dariusz.stojaczyk@intel.com> Cc: Darek Stojaczyk , Qi Zhang , Anatoly Burakov , stable@dpdk.org To: dev@dpdk.org Return-path: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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. Fixes: 244d5130719c ("eal: enable hotplug on multi-process") Cc: Qi Zhang Cc: Anatoly Burakov Cc: stable@dpdk.org Signed-off-by: Darek Stojaczyk --- lib/librte_eal/linux/eal/eal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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