From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 1EF90A05D3 for ; Tue, 26 Mar 2019 19:43:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DCABA1B473; Tue, 26 Mar 2019 19:43:54 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 680D11B46A; Tue, 26 Mar 2019 19:43:49 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Mar 2019 11:43:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,273,1549958400"; d="scan'208";a="156014718" Received: from ultraviolet.igk.intel.com ([10.102.17.137]) by fmsmga004.fm.intel.com with ESMTP; 26 Mar 2019 11:43:46 -0700 From: Darek Stojaczyk To: dev@dpdk.org Cc: Darek Stojaczyk , Qi Zhang , Anatoly Burakov , stable@dpdk.org Date: Tue, 26 Mar 2019 19:43:31 +0100 Message-Id: <20190326184331.13850-1-dariusz.stojaczyk@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [PATCH] eal: initialize alarms early X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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