dpdk: decrease intensity of warnings related to NUMA placement

Ticket: #5617
pull/8288/head
Lukas Sismis 4 years ago committed by Victor Julien
parent 991f9fde32
commit 563f8bb56b

@ -1358,6 +1358,7 @@ static void *ParseDpdkConfigAndConfigureDevice(const char *iface)
(void)SC_ATOMIC_ADD(iconf->ref, iconf->threads); (void)SC_ATOMIC_ADD(iconf->ref, iconf->threads);
// This counter is increased by worker threads that individually pick queue IDs. // This counter is increased by worker threads that individually pick queue IDs.
SC_ATOMIC_RESET(iconf->queue_id); SC_ATOMIC_RESET(iconf->queue_id);
SC_ATOMIC_RESET(iconf->inconsitent_numa_cnt);
return iconf; return iconf;
} }

@ -232,6 +232,19 @@ static int GetNumaNode(void)
return node; return node;
} }
static int GetCPU(void)
{
int cpu = -1;
#if defined(__linux__)
cpu = sched_getcpu();
#else
SCLogWarning(SC_ERR_TM_THREADS_ERROR, "CPU id retrieval is not supported on this OS.");
#endif
return cpu;
}
/** /**
* \brief Registration Function for ReceiveDPDK. * \brief Registration Function for ReceiveDPDK.
* \todo Unit tests are needed for this module. * \todo Unit tests are needed for this module.
@ -451,12 +464,20 @@ static TmEcode ReceiveDPDKThreadInit(ThreadVars *tv, const void *initdata, void
ptv->threads = dpdk_config->threads; ptv->threads = dpdk_config->threads;
ptv->port_id = dpdk_config->port_id; ptv->port_id = dpdk_config->port_id;
ptv->out_port_id = dpdk_config->out_port_id; ptv->out_port_id = dpdk_config->out_port_id;
uint16_t queue_id = SC_ATOMIC_ADD(dpdk_config->queue_id, 1);
ptv->queue_id = queue_id;
// pass the pointer to the mempool and then forget about it. Mempool is freed in thread deinit. // pass the pointer to the mempool and then forget about it. Mempool is freed in thread deinit.
ptv->pkt_mempool = dpdk_config->pkt_mempool; ptv->pkt_mempool = dpdk_config->pkt_mempool;
dpdk_config->pkt_mempool = NULL; dpdk_config->pkt_mempool = NULL;
thread_numa = GetNumaNode();
if (thread_numa >= 0 && thread_numa != rte_eth_dev_socket_id(ptv->port_id)) {
SC_ATOMIC_ADD(dpdk_config->inconsitent_numa_cnt, 1);
SCLogInfo("NIC on NUMA %d but thread id %d on NUMA %d. Decreased performance expected",
rte_eth_dev_socket_id(ptv->port_id), GetCPU(), thread_numa);
}
uint16_t queue_id = SC_ATOMIC_ADD(dpdk_config->queue_id, 1);
ptv->queue_id = queue_id;
// the last thread starts the device // the last thread starts the device
if (queue_id == dpdk_config->threads - 1) { if (queue_id == dpdk_config->threads - 1) {
retval = rte_eth_dev_start(ptv->port_id); retval = rte_eth_dev_start(ptv->port_id);
@ -476,13 +497,15 @@ static TmEcode ReceiveDPDKThreadInit(ThreadVars *tv, const void *initdata, void
// some PMDs requires additional actions only after the device has started // some PMDs requires additional actions only after the device has started
DevicePostStartPMDSpecificActions(ptv, dev_info.driver_name); DevicePostStartPMDSpecificActions(ptv, dev_info.driver_name);
}
thread_numa = GetNumaNode(); uint16_t inconsist_numa_map = SC_ATOMIC_GET(dpdk_config->inconsitent_numa_cnt);
if (thread_numa >= 0 && thread_numa != rte_eth_dev_socket_id(ptv->port_id)) { if (inconsist_numa_map > 0) {
SCLogWarning(SC_WARN_DPDK_CONF, SCLogWarning(SC_WARN_DPDK_CONF,
"NIC on NUMA %d but thread on NUMA %d. Decreased performance expected", "Expect decreased performance due to interface (%s) being on NUMA node %d "
rte_eth_dev_socket_id(ptv->port_id), thread_numa); "but is used by %d threads on distinct NUMA nodes. "
"Run with verbose logging to determine individual thread ids",
dpdk_config->iface, rte_eth_dev_socket_id(ptv->port_id), inconsist_numa_map);
}
} }
*data = (void *)ptv; *data = (void *)ptv;

@ -69,6 +69,7 @@ typedef struct DPDKIfaceConfig_ {
SC_ATOMIC_DECLARE(unsigned int, ref); SC_ATOMIC_DECLARE(unsigned int, ref);
/* threads bind queue id one by one */ /* threads bind queue id one by one */
SC_ATOMIC_DECLARE(uint16_t, queue_id); SC_ATOMIC_DECLARE(uint16_t, queue_id);
SC_ATOMIC_DECLARE(uint16_t, inconsitent_numa_cnt);
void (*DerefFunc)(void *); void (*DerefFunc)(void *);
struct rte_flow *flow[100]; struct rte_flow *flow[100];

Loading…
Cancel
Save