[dpdk-dev,3/3] eal: affinitize low-priority threads to lcore 0
Commit Message
There are extra utility threads inside the linuxapp EAL, for managing
things like interrupts, requests for the vfio file handle for
multi-process, and hpet timer management. These are mostly sleeping, but
to avoid any possibility of conflict with threads handling packets, this
patch affinitizes those threads to lcore 0 explicitly.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/librte_eal/linuxapp/eal/eal_interrupts.c | 5 +++++
lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c | 6 ++++++
lib/librte_eal/linuxapp/eal/eal_timer.c | 5 +++++
3 files changed, 16 insertions(+)
@@ -739,6 +739,11 @@ eal_intr_thread_main(__rte_unused void *arg)
{
struct epoll_event ev;
+ /* set our affinity to lcore 0 so we never interfere with the normal
+ * data-plane threads. Lcore 0 is used by Linux so is subject to
+ * interruptions anyway. */
+ rte_eal_thread_set_affinity(0);
+
/* host thread, never break out */
for (;;) {
/* build up the epoll fd with all descriptors we are to
@@ -53,6 +53,7 @@
#include <rte_eal_memconfig.h>
#include <rte_malloc.h>
+#include <eal_private.h>
#include "eal_filesystem.h"
#include "eal_pci_init.h"
@@ -268,6 +269,11 @@ pci_vfio_mp_sync_thread(void __rte_unused * arg)
{
int ret, fd, vfio_group_no;
+ /* set our affinity to lcore 0 so we never interfere with the normal
+ * data-plane threads. Lcore 0 is used by Linux so is subject to
+ * interruptions anyway. */
+ rte_eal_thread_set_affinity(0);
+
/* wait for requests on the socket */
for (;;) {
int conn_sock;
@@ -125,6 +125,11 @@ hpet_msb_inc(__attribute__((unused)) void *arg)
{
uint32_t t;
+ /* set our affinity to lcore 0 so we never interfere with the normal
+ * data-plane threads. Lcore 0 is used by Linux so is subject to
+ * interruptions anyway. */
+ rte_eal_thread_set_affinity(0);
+
while (1) {
t = (eal_hpet->counter_l >> 30);
if (t != (eal_hpet_msb & 3))