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 at 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(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c 
b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index dc2668a..6227f2b 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -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
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c 
b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
index 6588fb1..ccccbdb 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
@@ -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;
diff --git a/lib/librte_eal/linuxapp/eal/eal_timer.c 
b/lib/librte_eal/linuxapp/eal/eal_timer.c
index ca57916..f61e303 100644
--- a/lib/librte_eal/linuxapp/eal/eal_timer.c
+++ b/lib/librte_eal/linuxapp/eal/eal_timer.c
@@ -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))
-- 
1.9.3

Reply via email to