eal: initialize alarms early

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: stable@dpdk.org

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Darek Stojaczyk 2019-04-01 16:18:14 +02:00 committed by Thomas Monjalon
parent e840cb3c2a
commit ea4e3ab7bd
2 changed files with 12 additions and 12 deletions

View File

@ -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;

View File

@ -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;