DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 3/3] eal: affinitize low-priority threads to lcore 0
Date: Thu, 11 Sep 2014 15:23:07 +0100	[thread overview]
Message-ID: <1410445387-4849-4-git-send-email-bruce.richardson@intel.com> (raw)
In-Reply-To: <1410445387-4849-1-git-send-email-bruce.richardson@intel.com>

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

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

  parent reply	other threads:[~2014-09-11 14:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1410445387-4849-1-git-send-email-bruce.richardson@intel.com>
2014-09-11 14:23 ` [dpdk-dev] [PATCH 1/3] eal: add core id param to eal_thread_set_affinity Bruce Richardson
2014-09-11 14:23 ` [dpdk-dev] [PATCH 2/3] eal: increase scope of eal_thread_set_affinity Bruce Richardson
2014-09-11 14:23 ` Bruce Richardson [this message]
2014-09-11 23:47 ` [dpdk-dev] [PATCH 0/3] eal affinitize low priority threads to lcore 0 Hiroshi Shimamoto
2014-09-12  1:24   ` Stephen Hemminger
2014-09-12  8:07   ` Richardson, Bruce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1410445387-4849-4-git-send-email-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).