Skip to content

Commit

Permalink
DPDK library changes for setting control thread mask
Browse files Browse the repository at this point in the history
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.

Depends-On: I100dccb7d2dbb86d02a36ad929b5fa571e38393f
Closes-Jira-Bug: CEM-12161
Change-Id: I1122423915ca93cb76f8eef36bbf854fc08418c6
  • Loading branch information
Anish56 committed Feb 21, 2020
1 parent cd096b8 commit b289333
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions lib/librte_eal/common/eal_common_options.c
Expand Up @@ -39,6 +39,7 @@ eal_short_options[] =
"b:" /* pci-blacklist */
"c:" /* coremask */
"s:" /* service coremask */
"t:" /* control threads */
"d:" /* driver */
"h" /* help */
"l:" /* corelist */
Expand Down Expand Up @@ -1057,7 +1058,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':
Expand Down Expand Up @@ -1120,6 +1121,17 @@ eal_parse_common_option(int opt, const char *optarg,
return -1;
}
break;
/* control threads */
case 't':
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) {
Expand Down Expand Up @@ -1305,7 +1317,8 @@ 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() */
Expand Down Expand Up @@ -1372,6 +1385,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"
" -t 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"
Expand Down

6 comments on commit b289333

@david-marchand
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference with starting your dpdk application with taskset (Linux) / cpuset (FreeBSD)?

@kirankn80
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use taskset to determine the coremask for forwarding threads only. This particular patch adds support to provide coremask for DPDK control threads as well.

@david-marchand
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the opposite way of OVS.
I can see nothing wrong with this approach, but this should have been discussed upstream.

@kirankn80
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi David, we can surely discuss this in upstream. The use of taskset to determine the coremask for forwarding threads is from day-1 of vrouter-dpdk.

@kirankn80
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi David, does this review look fine to you? Any comments?

@david-marchand
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you intend to upstream this patch, the discussion must happen on the dev@dpdk.org mailing list.

Please sign in to comment.