Commit 1826245a authored by Sarvesh Lanke's avatar Sarvesh Lanke Committed by Jim Harris
Browse files

test/nvmf: Add no-hugepages functionality to NVMf tests



Adding no-hugepages to the existing NVMf tests will enable the tests
to run without hugepages. These tests check the functionality of
NVMf over TCP running on a target without hugepages.

Change-Id: I7bdd1afeafd888cb52530d43fc0c1d1bda926a96
Signed-off-by: default avatarSarvesh Lanke <sarvesh.lanke@nutanix.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/20339


Reviewed-by: default avatarMichal Berger <michal.berger@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarAbhineet Pandey <abhineet.pandey@nutanix.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent a6658c54
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include "spdk/util.h"
#include "spdk/likely.h"

#define ABORT_GETOPT_STRING "a:c:i:l:o:q:r:s:t:w:GM:T:"
struct ctrlr_entry {
	struct spdk_nvme_ctrlr		*ctrlr;
	enum spdk_nvme_transport_type	trtype;
@@ -96,9 +97,16 @@ static int g_shm_id = -1;
static bool g_no_pci;
static bool g_warn;
static bool g_mix_specified;
static bool g_no_hugepages;

static const char *g_core_mask;

static const struct option g_abort_cmdline_opts[] = {
#define ABORT_NO_HUGE        257
	{"no-huge",			no_argument,	NULL, ABORT_NO_HUGE},
	{0, 0, 0, 0}
};

struct trid_entry {
	struct spdk_nvme_transport_id	trid;
	uint16_t			nsid;
@@ -557,6 +565,7 @@ usage(char *program_name)
	printf("\t[-s DPDK huge memory size in MB.]\n");
	printf("\t[-i shared memory group ID]\n");
	printf("\t[-a abort interval.]\n");
	printf("\t[--no-huge SPDK is run without hugepages\n");
	printf("\t");
	spdk_log_usage(stdout, "-T");
#ifdef DEBUG
@@ -640,11 +649,12 @@ add_trid(const char *trid_str)
static int
parse_args(int argc, char **argv)
{
	int op;
	int op, opt_index;
	long int val;
	int rc;

	while ((op = getopt(argc, argv, "a:c:i:l:o:q:r:s:t:w:GM:T:")) != -1) {
	while ((op = getopt_long(argc, argv, ABORT_GETOPT_STRING, g_abort_cmdline_opts,
				 &opt_index)) != -1) {
		switch (op) {
		case 'a':
		case 'i':
@@ -735,6 +745,9 @@ parse_args(int argc, char **argv)
				return 1;
			}
			break;
		case ABORT_NO_HUGE:
			g_no_hugepages = true;
			break;
		default:
			usage(argv[0]);
			return 1;
@@ -1075,6 +1088,9 @@ main(int argc, char **argv)
	if (g_no_pci) {
		opts.no_pci = g_no_pci;
	}
	if (g_no_hugepages) {
		opts.no_huge = true;
	}
	if (spdk_env_init(&opts) < 0) {
		fprintf(stderr, "Unable to initialize SPDK env\n");
		unregister_trids();
+6 −0
Original line number Diff line number Diff line
@@ -1919,6 +1919,7 @@ usage(char *program_name)
	printf("\t-R, --enable-uring enable using liburing to drive kernel devices (Default: libaio)\n");
#endif
	printf("\t--iova-mode <mode> specify DPDK IOVA mode: va|pa\n");
	printf("\t--no-huge, SPDK is run without hugepages\n");
	printf("\n");

	printf("==== PCIe OPTIONS ====\n\n");
@@ -2479,6 +2480,8 @@ static const struct option g_perf_cmdline_opts[] = {
	{"rdma-srq-size", required_argument, NULL, PERF_RDMA_SRQ_SIZE},
#define PERF_USE_EVERY_CORE	269
	{"use-every-core", no_argument, NULL, PERF_USE_EVERY_CORE},
#define PERF_NO_HUGE		270
	{"no-huge", no_argument, NULL, PERF_NO_HUGE},
	/* Should be the last element */
	{0, 0, 0, 0}
};
@@ -2742,6 +2745,9 @@ parse_args(int argc, char **argv, struct spdk_env_opts *env_opts)
			}
			g_transport_tos = val;
			break;
		case PERF_NO_HUGE:
			env_opts->no_huge = true;
			break;
		default:
			usage(argv[0]);
			return 1;
+13 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include "spdk_internal/event.h"

#define NVMF_DEFAULT_SUBSYSTEMS		32
#define NVMF_GETOPT_STRING "g:i:m:n:p:r:s:u:h"

static const char *g_rpc_addr = SPDK_DEFAULT_RPC_ADDR;

@@ -95,15 +96,22 @@ usage(char *program_name)
	printf("\t[-r RPC listen address (default /var/tmp/spdk.sock)]\n");
	printf("\t[-s memory size in MB for DPDK (default: 0MB)]\n");
	printf("\t[-u disable PCI access]\n");
	printf("\t[--no-huge SPDK is run without hugepages]\n");
}

static const struct option g_nvmf_cmdline_opts[] = {
#define NVMF_NO_HUGE        257
	{"no-huge",			no_argument,	NULL, NVMF_NO_HUGE},
	{0, 0, 0, 0}
};

static int
parse_args(int argc, char **argv, struct spdk_env_opts *opts)
{
	int op;
	int op, opt_index;
	long int value;

	while ((op = getopt(argc, argv, "g:i:m:n:p:r:s:u:h")) != -1) {
	while ((op = getopt_long(argc, argv, NVMF_GETOPT_STRING, g_nvmf_cmdline_opts, &opt_index)) != -1) {
		switch (op) {
		case 'g':
			value = spdk_strtol(optarg, 10);
@@ -148,6 +156,9 @@ parse_args(int argc, char **argv, struct spdk_env_opts *opts)
		case 'h':
			usage(argv[0]);
			exit(EXIT_SUCCESS);
		case NVMF_NO_HUGE:
			opts->no_huge = true;
			break;
		default:
			usage(argv[0]);
			return 1;
+4 −0
Original line number Diff line number Diff line
@@ -285,6 +285,7 @@ if [ -z "${output_dir:-}" ]; then
	export output_dir="$rootdir/../output"
fi

NO_HUGE=()
TEST_MODE=
for i in "$@"; do
	case "$i" in
@@ -297,6 +298,9 @@ for i in "$@"; do
		--sock=*)
			TEST_SOCK="${i#*=}"
			;;
		--no-hugepages)
			NO_HUGE=(--no-huge -s 1024)
			;;
	esac
done

+6 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ usage(char *program_name)
#else
	printf("\t[-G, --enable-debug enable debug logging (flag disabled, must reconfigure with --enable-debug)]\n");
	printf("\t[--iova-mode <mode> specify DPDK IOVA mode: va|pa]\n");
	printf("\t[--no-huge, SPDK is run without hugepages\n");
#endif
}

@@ -87,6 +88,8 @@ static const struct option g_cmdline_opts[] = {
	{"logflag",			required_argument,	NULL, PERF_LOG_FLAG},
#define PERF_IOVA_MODE		258
	{"iova-mode",			required_argument,	NULL, PERF_IOVA_MODE},
#define PERF_NO_HUGE		259
	{"no-huge",		no_argument,		NULL, PERF_NO_HUGE},
	/* Should be the last element */
	{0, 0, 0, 0}
};
@@ -168,6 +171,9 @@ parse_args(int argc, char **argv, struct spdk_env_opts *env_opts)
		case PERF_IOVA_MODE:
			env_opts->iova_mode = optarg;
			break;
		case PERF_NO_HUGE:
			env_opts->no_huge = true;
			break;
		default:
			usage(argv[0]);
			return 1;
Loading