DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kiran KN <kirankn@juniper.net>
To: "dev@dpdk.org" <dev@dpdk.org>
Cc: Thomas Monjalon <thomas@monjalon.net>,
	"david.marchand@redhat.com" <david.marchand@redhat.com>
Subject: [dpdk-dev] [PATCH] eal: changes for setting control thread mask
Date: Tue, 21 Apr 2020 07:42:28 +0000	[thread overview]
Message-ID: <1BA38E99-C6F7-4A17-B6CA-D1D06F707590@juniper.net> (raw)


Define a global variable ctrl_thread_set which the application can set.
If this is the case, use this for setting control thread affinity instead
of deducing it from the existing core pinning of the process.

signed-off-by: Kiran KN <kirankn@juniper.net>
---
 lib/librte_eal/common/eal_common_options.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index a7f9c5f9b..1b99a986d 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -41,6 +41,7 @@ eal_short_options[] =
 	"b:" /* pci-blacklist */
 	"c:" /* coremask */
 	"s:" /* service coremask */
+	"C:" /* control threads */
 	"d:" /* driver */
 	"h"  /* help */
 	"l:" /* corelist */
@@ -1201,7 +1202,7 @@ eal_parse_common_option(int opt, const char *optarg,
 {
 	static int b_used;
 	static int w_used;
-
+	static uint16_t set[RTE_MAX_LCORE];
 	switch (opt) {
 	/* blacklist */
 	case 'b':
@@ -1295,6 +1296,17 @@ eal_parse_common_option(int opt, const char *optarg,
 			return -1;
 		}
 		break;
+	/* control threads */
+	case 'C':
+		if (eal_parse_set(optarg, set, RTE_DIM(set)) < 0) {
+			RTE_LOG(ERR, EAL, "invalid control threads\n");
+			return -1;
+		}
+		if (convert_to_cpuset(&conf->ctrl_cpuset, set, RTE_DIM(set)) < 0) {
+			RTE_LOG(ERR, EAL, "Error adding set to control cpuset\n");
+			return -1;
+		}
+		break;
 	/* service corelist */
 	case 'S':
 		if (eal_parse_service_corelist(optarg) < 0) {
@@ -1542,7 +1554,9 @@ eal_adjust_config(struct internal_config *internal_cfg)
 		lcore_config[cfg->master_lcore].core_role = ROLE_RTE;
 	}
 
-	compute_ctrl_threads_cpuset(internal_cfg);
+	if (CPU_COUNT(&internal_cfg->ctrl_cpuset) == 0) {
+		compute_ctrl_threads_cpuset(internal_cfg);
+	}
 
 	/* if no memory amounts were requested, this will result in 0 and
 	 * will be overridden later, right after eal_hugepage_info_init() */
@@ -1656,6 +1670,10 @@ eal_common_usage(void)
 	       "                      '( )' can be omitted for single element group,\n"
 	       "                      '@' can be omitted if cpus and lcores have the same value\n"
 	       "  -s SERVICE COREMASK Hexadecimal bitmask of cores to be used as service cores\n"
+	       "  -C CONTROL THREADS  The argument format is\n"
+	       "                           (list of cpus) or Hexadecimal bitmask of cores\n"
+	       "                      Within the list of cpus, '-' is used as range seperator,\n"
+	       "                      ',' is used for single number seperator.\n"
 	       "  --"OPT_MASTER_LCORE" ID   Core ID that is used as master\n"
 	       "  --"OPT_MBUF_POOL_OPS_NAME" Pool ops name for mbuf to use\n"
 	       "  -n CHANNELS         Number of memory channels\n"
-- 
2.16.6



             reply	other threads:[~2020-04-21  7:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21  7:42 Kiran KN [this message]
2020-04-21  8:01 ` David Marchand
2021-03-25 14:51   ` David Marchand
2021-03-27 18:54     ` Kiran KN

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=1BA38E99-C6F7-4A17-B6CA-D1D06F707590@juniper.net \
    --to=kirankn@juniper.net \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /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).