env: replace master_core with main_core

This helps us remove master/slave terminology from
SPDK and is aligned with similar changes made recently
in DPDK.

While updating nvme/identify to use the new member
name, also replace g_master_core there with g_main_core.
Other nvme utility usage of "master_core" will be updated
in a later patch.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I0ec4e3e9b644bec21b3729809bf5c4d35b10837f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5351
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Jim Harris 2020-11-30 19:44:19 +00:00 committed by Tomasz Zawadzki
parent 131e617191
commit fe137c8970
8 changed files with 25 additions and 19 deletions

View File

@ -15,8 +15,9 @@ The --pci-whitelist/-W command line options have been deprecated, replaced with
### env ### env
The pci_whitelist and pci_blacklist members of struct spdk_env_opts have been The pci_whitelist, pci_blacklist and master_core members of struct spdk_env_opts
deprecated. The new members are named pci_allowed and pci_blocked respectively. have been deprecated. The new members are named pci_allowed, pci_blocked and
main_core respectively.
### nvmf ### nvmf

View File

@ -35,7 +35,7 @@ Param | Long Param | Type | Default | Descript
-i | --shm-id | integer | | @ref cmd_arg_multi_process -i | --shm-id | integer | | @ref cmd_arg_multi_process
-m | --cpumask | CPU mask | 0x1 | application @ref cpu_mask -m | --cpumask | CPU mask | 0x1 | application @ref cpu_mask
-n | --mem-channels | integer | all channels | number of memory channels used for DPDK -n | --mem-channels | integer | all channels | number of memory channels used for DPDK
-p | --master-core | integer | first core in CPU mask | master (primary) core for DPDK -p | --main-core | integer | first core in CPU mask | main (primary) core for DPDK
-r | --rpc-socket | string | /var/tmp/spdk.sock | RPC listen address -r | --rpc-socket | string | /var/tmp/spdk.sock | RPC listen address
-s | --mem-size | integer | all hugepage memory | @ref cmd_arg_memory_size -s | --mem-size | integer | all hugepage memory | @ref cmd_arg_memory_size
| | --silence-noticelog | flag | | disable notice level logging to `stderr` | | --silence-noticelog | flag | | disable notice level logging to `stderr`

View File

@ -222,7 +222,7 @@ host:~# HUGEMEM=2048 ./scripts/setup.sh
~~~{.sh} ~~~{.sh}
host:~# ./build/bin/vhost -S /var/tmp -s 1024 -m 0x3 & host:~# ./build/bin/vhost -S /var/tmp -s 1024 -m 0x3 &
Starting DPDK 17.11.0 initialization... Starting DPDK 17.11.0 initialization...
[ DPDK EAL parameters: vhost -c 3 -m 1024 --master-lcore=1 --file-prefix=spdk_pid156014 ] [ DPDK EAL parameters: vhost -c 3 -m 1024 --main-lcore=1 --file-prefix=spdk_pid156014 ]
EAL: Detected 48 lcore(s) EAL: Detected 48 lcore(s)
EAL: Probing VFIO support... EAL: Probing VFIO support...
EAL: VFIO support initialized EAL: VFIO support initialized

View File

@ -99,7 +99,7 @@ static int g_dpdk_mem = 0;
static bool g_dpdk_mem_single_seg = false; static bool g_dpdk_mem_single_seg = false;
static int g_master_core = 0; static int g_main_core = 0;
static char g_core_mask[16] = "0x1"; static char g_core_mask[16] = "0x1";
@ -1953,12 +1953,12 @@ parse_args(int argc, char **argv)
} }
break; break;
case 'p': case 'p':
g_master_core = spdk_strtol(optarg, 10); g_main_core = spdk_strtol(optarg, 10);
if (g_master_core < 0) { if (g_main_core < 0) {
fprintf(stderr, "Invalid core number\n"); fprintf(stderr, "Invalid core number\n");
return g_master_core; return g_main_core;
} }
snprintf(g_core_mask, sizeof(g_core_mask), "0x%llx", 1ULL << g_master_core); snprintf(g_core_mask, sizeof(g_core_mask), "0x%llx", 1ULL << g_main_core);
break; break;
case 'r': case 'r':
if (spdk_nvme_transport_id_parse(&g_trid, optarg) != 0) { if (spdk_nvme_transport_id_parse(&g_trid, optarg) != 0) {
@ -2027,7 +2027,7 @@ int main(int argc, char **argv)
opts.shm_id = g_shm_id; opts.shm_id = g_shm_id;
opts.mem_size = g_dpdk_mem; opts.mem_size = g_dpdk_mem;
opts.mem_channel = 1; opts.mem_channel = 1;
opts.master_core = g_master_core; opts.main_core = g_main_core;
opts.core_mask = g_core_mask; opts.core_mask = g_core_mask;
opts.hugepage_single_segments = g_dpdk_mem_single_seg; opts.hugepage_single_segments = g_dpdk_mem_single_seg;
if (g_trid.trtype != SPDK_NVME_TRANSPORT_PCIE) { if (g_trid.trtype != SPDK_NVME_TRANSPORT_PCIE) {

View File

@ -76,7 +76,10 @@ struct spdk_env_opts {
const char *core_mask; const char *core_mask;
int shm_id; int shm_id;
int mem_channel; int mem_channel;
int master_core; union {
int main_core;
int master_core __attribute__((deprecated));
};
int mem_size; int mem_size;
bool no_pci; bool no_pci;
bool hugepage_single_segments; bool hugepage_single_segments;

View File

@ -47,7 +47,7 @@
#define SPDK_ENV_DPDK_DEFAULT_NAME "spdk" #define SPDK_ENV_DPDK_DEFAULT_NAME "spdk"
#define SPDK_ENV_DPDK_DEFAULT_SHM_ID -1 #define SPDK_ENV_DPDK_DEFAULT_SHM_ID -1
#define SPDK_ENV_DPDK_DEFAULT_MEM_SIZE -1 #define SPDK_ENV_DPDK_DEFAULT_MEM_SIZE -1
#define SPDK_ENV_DPDK_DEFAULT_MASTER_CORE -1 #define SPDK_ENV_DPDK_DEFAULT_MAIN_CORE -1
#define SPDK_ENV_DPDK_DEFAULT_MEM_CHANNEL -1 #define SPDK_ENV_DPDK_DEFAULT_MEM_CHANNEL -1
#define SPDK_ENV_DPDK_DEFAULT_CORE_MASK "0x1" #define SPDK_ENV_DPDK_DEFAULT_CORE_MASK "0x1"
#define SPDK_ENV_DPDK_DEFAULT_BASE_VIRTADDR 0x200000000000 #define SPDK_ENV_DPDK_DEFAULT_BASE_VIRTADDR 0x200000000000
@ -55,9 +55,11 @@
#if RTE_VERSION < RTE_VERSION_NUM(20, 11, 0, 0) #if RTE_VERSION < RTE_VERSION_NUM(20, 11, 0, 0)
#define DPDK_ALLOW_PARAM "--pci-whitelist" #define DPDK_ALLOW_PARAM "--pci-whitelist"
#define DPDK_BLOCK_PARAM "--pci-blacklist" #define DPDK_BLOCK_PARAM "--pci-blacklist"
#define DPDK_MAIN_CORE_PARAM "--master-lcore"
#else #else
#define DPDK_ALLOW_PARAM "--allow" #define DPDK_ALLOW_PARAM "--allow"
#define DPDK_BLOCK_PARAM "--block" #define DPDK_BLOCK_PARAM "--block"
#define DPDK_MAIN_CORE_PARAM "--main-lcore"
#endif #endif
static char **g_eal_cmdline; static char **g_eal_cmdline;
@ -127,7 +129,7 @@ spdk_env_opts_init(struct spdk_env_opts *opts)
opts->core_mask = SPDK_ENV_DPDK_DEFAULT_CORE_MASK; opts->core_mask = SPDK_ENV_DPDK_DEFAULT_CORE_MASK;
opts->shm_id = SPDK_ENV_DPDK_DEFAULT_SHM_ID; opts->shm_id = SPDK_ENV_DPDK_DEFAULT_SHM_ID;
opts->mem_size = SPDK_ENV_DPDK_DEFAULT_MEM_SIZE; opts->mem_size = SPDK_ENV_DPDK_DEFAULT_MEM_SIZE;
opts->master_core = SPDK_ENV_DPDK_DEFAULT_MASTER_CORE; opts->main_core = SPDK_ENV_DPDK_DEFAULT_MAIN_CORE;
opts->mem_channel = SPDK_ENV_DPDK_DEFAULT_MEM_CHANNEL; opts->mem_channel = SPDK_ENV_DPDK_DEFAULT_MEM_CHANNEL;
opts->base_virtaddr = SPDK_ENV_DPDK_DEFAULT_BASE_VIRTADDR; opts->base_virtaddr = SPDK_ENV_DPDK_DEFAULT_BASE_VIRTADDR;
} }
@ -303,10 +305,10 @@ build_eal_cmdline(const struct spdk_env_opts *opts)
} }
} }
/* set the master core */ /* set the main core */
if (opts->master_core > 0) { if (opts->main_core > 0) {
args = push_arg(args, &argcount, _sprintf_alloc("--master-lcore=%d", args = push_arg(args, &argcount, _sprintf_alloc("%s=%d",
opts->master_core)); DPDK_MAIN_CORE_PARAM, opts->main_core));
if (args == NULL) { if (args == NULL) {
return -1; return -1;
} }

View File

@ -764,7 +764,7 @@ mem_map_init(bool legacy_mem)
/* /*
* Walk all DPDK memory segments and register them * Walk all DPDK memory segments and register them
* with the master memory map * with the main memory map
*/ */
rte_mem_event_callback_register("spdk", memory_hotplug_cb, NULL); rte_mem_event_callback_register("spdk", memory_hotplug_cb, NULL);
rte_memseg_contig_walk(memory_iter_cb, NULL); rte_memseg_contig_walk(memory_iter_cb, NULL);

View File

@ -312,7 +312,7 @@ app_setup_env(struct spdk_app_opts *opts)
env_opts.core_mask = opts->reactor_mask; env_opts.core_mask = opts->reactor_mask;
env_opts.shm_id = opts->shm_id; env_opts.shm_id = opts->shm_id;
env_opts.mem_channel = opts->mem_channel; env_opts.mem_channel = opts->mem_channel;
env_opts.master_core = opts->master_core; env_opts.main_core = opts->master_core;
env_opts.mem_size = opts->mem_size; env_opts.mem_size = opts->mem_size;
env_opts.hugepage_single_segments = opts->hugepage_single_segments; env_opts.hugepage_single_segments = opts->hugepage_single_segments;
env_opts.unlink_hugepage = opts->unlink_hugepage; env_opts.unlink_hugepage = opts->unlink_hugepage;