Commit 90b54d76 authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

test/app/stub: add command line option to set default io_queue_size



Commit ebdb06bc ("stub: fix a io_queue_size limitation") set the default
ctrlr io_queue_size to UINT16_MAX. Details from the commit message and
old GerritHub URL aren't clear what the performance issue was though.
SPDK performance reports are all generated without using stub app to my
knowledge.

This causes problems when using the stub app with performance tools such as
fio. fio doesn't specify io_qpair options, so it will just default to whatever
was set when the controller was attached. Without the stub, it will use
default (256) but with the stub running it uses whatever max supported
by the controller (MQES). This can cause performance anomalies, but less
pleasant are the out-of-memory issues due to all of the extra trackers this
tries to allocate for tests with lots of jobs.

So change this up so that by default, we don't change the default - only
change it if user passed some value via command line.

Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
Change-Id: Ia68a76b6272b2ef307d6f4e346e204d80c474828
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22448


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent ec9e6728
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ static char g_path[256];
static struct spdk_poller *g_poller;
/* default sleep time in ms */
static uint32_t g_sleep_time = 1000;
static uint32_t g_io_queue_size;

struct ctrlr_entry {
	struct spdk_nvme_ctrlr *ctrlr;
@@ -51,6 +52,7 @@ usage(char *executable_name)
	printf(" -p core    main (primary) core for DPDK\n");
	printf(" -s size    memory size in MB for DPDK\n");
	printf(" -t msec    sleep time (ms) between checking for admin completions\n");
	printf(" -q size    override default io_queue_size when attaching controllers\n");
	printf(" -H         show this usage\n");
}

@@ -58,11 +60,9 @@ static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
	 struct spdk_nvme_ctrlr_opts *opts)
{
	/*
	 * Set the io_queue_size to UINT16_MAX to initialize
	 * the controller with the possible largest queue size.
	 */
	opts->io_queue_size = UINT16_MAX;
	if (g_io_queue_size > 0) {
		opts->io_queue_size = g_io_queue_size;
	}
	return true;
}

@@ -139,7 +139,7 @@ main(int argc, char **argv)
	opts.name = "stub";
	opts.rpc_addr = NULL;

	while ((ch = getopt(argc, argv, "i:m:n:p:s:t:H")) != -1) {
	while ((ch = getopt(argc, argv, "i:m:n:p:q:s:t:H")) != -1) {
		if (ch == 'm') {
			opts.reactor_mask = optarg;
		} else if (ch == '?' || ch == 'H') {
@@ -167,6 +167,9 @@ main(int argc, char **argv)
			case 't':
				g_sleep_time = val;
				break;
			case 'q':
				g_io_queue_size = val;
				break;
			default:
				usage(argv[0]);
				exit(EXIT_FAILURE);