DPDK lcores range is [0, RTE_MAX_LCORE[. Trying to use a lcore out of this range expose OVS to crashes in DPDK mempool local cache array. Prefer a "clean" abort so that users know that something is wrong with their configuration.
Signed-off-by: David Marchand <[email protected]> --- lib/dpdk.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/dpdk.c b/lib/dpdk.c index 98d0e2643e..55ce9a9221 100644 --- a/lib/dpdk.c +++ b/lib/dpdk.c @@ -617,7 +617,14 @@ dpdk_set_lcore_id(unsigned cpu) { /* NON_PMD_CORE_ID is reserved for use by non pmd threads. */ ovs_assert(cpu != NON_PMD_CORE_ID); + if (cpu >= RTE_MAX_LCORE) { + cpu = LCORE_ID_ANY; + } RTE_PER_LCORE(_lcore_id) = cpu; + if (rte_lcore_id() == LCORE_ID_ANY) { + ovs_abort(0, "PMD thread init failed, trying to use more cores than " + "DPDK supports (RTE_MAX_LCORE %u).", RTE_MAX_LCORE); + } } void -- 2.23.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
