eal: changes for setting control thread mask
diff mbox series

Message ID 1BA38E99-C6F7-4A17-B6CA-D1D06F707590@juniper.net
State New
Delegated to: David Marchand
Headers show
Series
  • eal: changes for setting control thread mask
Related show

Checks

Context Check Description
ci/travis-robot warning Travis build: failed
ci/Performance-Testing fail build patch failure
ci/Intel-compilation fail Compilation issues
ci/checkpatch warning coding style issues

Commit Message

Kiran KN April 21, 2020, 7:42 a.m. UTC
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(-)

Comments

David Marchand April 21, 2020, 8:01 a.m. UTC | #1
On Tue, Apr 21, 2020 at 9:42 AM Kiran KN <kirankn@juniper.net> wrote:
> 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.

I am unconvinced on adding an EAL option for this.
It needs an explanation on why you can't rely on the dpdk process
current affinity for control threads.
And we will need a unit test.

Please rebase your patch on master too.

> signed-off-by: Kiran KN <kirankn@juniper.net>

Signed-off-by*

Patch
diff mbox series

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"