examples/nvme: export DPDK single file descriptor memory segments as input parameter

Similar with existing virtio user driver, we need to enable "--single-file-segments"
option in DPDK as the target only support limited number of memory regions, for
coming vfio-user feature, the requirement is same, so here we enable the option
with identify&perf tools in advance.

Change-Id: I83d78b403a8c1ec0c76a5bf21aac6bed109931c3
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4612
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Changpeng Liu 2020-10-13 02:44:18 -04:00 committed by Tomasz Zawadzki
parent eecc14df19
commit e3f08eef8c
2 changed files with 15 additions and 2 deletions

View File

@ -91,6 +91,8 @@ static int g_shm_id = -1;
static int g_dpdk_mem = 0; static int g_dpdk_mem = 0;
static bool g_dpdk_mem_single_seg = false;
static int g_master_core = 0; static int g_master_core = 0;
static char g_core_mask[16] = "0x1"; static char g_core_mask[16] = "0x1";
@ -1776,6 +1778,7 @@ usage(const char *program_name)
printf(" -i shared memory group ID\n"); printf(" -i shared memory group ID\n");
printf(" -p core number in decimal to run this application which started from 0\n"); printf(" -p core number in decimal to run this application which started from 0\n");
printf(" -d DPDK huge memory size in MB\n"); printf(" -d DPDK huge memory size in MB\n");
printf(" -g use single file descriptor for DPDK memory segments\n");
printf(" -x print hex dump of raw data\n"); printf(" -x print hex dump of raw data\n");
printf(" -v verbose (enable warnings)\n"); printf(" -v verbose (enable warnings)\n");
printf(" -V enumerate VMD\n"); printf(" -V enumerate VMD\n");
@ -1790,7 +1793,7 @@ parse_args(int argc, char **argv)
spdk_nvme_trid_populate_transport(&g_trid, SPDK_NVME_TRANSPORT_PCIE); spdk_nvme_trid_populate_transport(&g_trid, SPDK_NVME_TRANSPORT_PCIE);
snprintf(g_trid.subnqn, sizeof(g_trid.subnqn), "%s", SPDK_NVMF_DISCOVERY_NQN); snprintf(g_trid.subnqn, sizeof(g_trid.subnqn), "%s", SPDK_NVMF_DISCOVERY_NQN);
while ((op = getopt(argc, argv, "d:i:p:r:xHL:V")) != -1) { while ((op = getopt(argc, argv, "d:gi:p:r:xHL:V")) != -1) {
switch (op) { switch (op) {
case 'd': case 'd':
g_dpdk_mem = spdk_strtol(optarg, 10); g_dpdk_mem = spdk_strtol(optarg, 10);
@ -1799,6 +1802,9 @@ parse_args(int argc, char **argv)
return g_dpdk_mem; return g_dpdk_mem;
} }
break; break;
case 'g':
g_dpdk_mem_single_seg = true;
break;
case 'i': case 'i':
g_shm_id = spdk_strtol(optarg, 10); g_shm_id = spdk_strtol(optarg, 10);
if (g_shm_id < 0) { if (g_shm_id < 0) {
@ -1883,6 +1889,7 @@ int main(int argc, char **argv)
opts.mem_channel = 1; opts.mem_channel = 1;
opts.master_core = g_master_core; opts.master_core = g_master_core;
opts.core_mask = g_core_mask; opts.core_mask = g_core_mask;
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) {
opts.no_pci = true; opts.no_pci = true;
} }

View File

@ -241,6 +241,7 @@ static int g_time_in_sec;
static int g_warmup_time_in_sec; static int g_warmup_time_in_sec;
static uint32_t g_max_completions; static uint32_t g_max_completions;
static int g_dpdk_mem; static int g_dpdk_mem;
static bool g_dpdk_mem_single_seg = false;
static int g_shm_id = -1; static int g_shm_id = -1;
static uint32_t g_disable_sq_cmb; static uint32_t g_disable_sq_cmb;
static bool g_use_uring; static bool g_use_uring;
@ -1404,6 +1405,7 @@ static void usage(char *program_name)
printf("\t -e 'PRACT=1,PRCHK=GUARD'\n"); printf("\t -e 'PRACT=1,PRCHK=GUARD'\n");
printf("\t[-k keep alive timeout period in millisecond]\n"); printf("\t[-k keep alive timeout period in millisecond]\n");
printf("\t[-s DPDK huge memory size in MB.]\n"); printf("\t[-s DPDK huge memory size in MB.]\n");
printf("\t[-g use single file descriptor for DPDK memory segments]\n");
printf("\t[-C max completions per poll]\n"); printf("\t[-C max completions per poll]\n");
printf("\t\t(default: 0 - unlimited)\n"); printf("\t\t(default: 0 - unlimited)\n");
printf("\t[-i shared memory group ID]\n"); printf("\t[-i shared memory group ID]\n");
@ -1807,7 +1809,7 @@ parse_args(int argc, char **argv)
long int val; long int val;
int rc; int rc;
while ((op = getopt(argc, argv, "a:c:e:i:lo:q:r:k:s:t:w:z:A:C:DGHILM:NP:RS:T:U:VZ:")) != -1) { while ((op = getopt(argc, argv, "a:c:e:gi:lo:q:r:k:s:t:w:z:A:C:DGHILM:NP:RS:T:U:VZ:")) != -1) {
switch (op) { switch (op) {
case 'a': case 'a':
case 'A': case 'A':
@ -1882,6 +1884,9 @@ parse_args(int argc, char **argv)
return 1; return 1;
} }
break; break;
case 'g':
g_dpdk_mem_single_seg = true;
break;
case 'l': case 'l':
g_latency_ssd_tracking_enable = true; g_latency_ssd_tracking_enable = true;
break; break;
@ -2285,6 +2290,7 @@ int main(int argc, char **argv)
if (g_dpdk_mem) { if (g_dpdk_mem) {
opts.mem_size = g_dpdk_mem; opts.mem_size = g_dpdk_mem;
} }
opts.hugepage_single_segments = g_dpdk_mem_single_seg;
if (g_no_pci) { if (g_no_pci) {
opts.no_pci = g_no_pci; opts.no_pci = g_no_pci;
} }