From b3ca1c70ee8966f79be32165ee65470118a96537 Mon Sep 17 00:00:00 2001 From: Evgeniy Kochetov Date: Thu, 5 Aug 2021 15:56:07 +0300 Subject: [PATCH] nvme/perf: Add option to set NVMe IO queue size Some targets advertise large Maximum Queue Entries Supported (MQES) value but fail to create long queues due to some other limitations, e.g. lack of some resource. New '--io-queue-size' option allows to workaround such issues. It may also be useful when researching queue size impact on performance. Signed-off-by: Evgeniy Kochetov Change-Id: Ie13b966070fbe5d8bb75cee59ae171bd25eafa63 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9090 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris --- examples/nvme/perf/perf.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index e28778911..26e750749 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -272,6 +272,10 @@ static bool g_exit; static uint32_t g_keep_alive_timeout_in_ms = 10000; static uint32_t g_quiet_count = 1; static double g_zipf_theta; +/* Set default io_queue_size to UINT16_MAX, NVMe driver will then reduce this + * to MQES to maximize the io_queue_size as much as possible. + */ +static uint32_t g_io_queue_size = UINT16_MAX; /* When user specifies -Q, some error messages are rate limited. When rate * limited, we only print the error message every g_quiet_count times the @@ -1793,6 +1797,7 @@ static void usage(char *program_name) #endif printf("\t[--transport-stats dump transport statistics]\n"); printf("\t[--iova-mode specify DPDK IOVA mode: va|pa]\n"); + printf("\t[--io-queue-size size of NVMe IO queue. Default: maximum allowed by controller]\n"); } static void @@ -2286,6 +2291,8 @@ static const struct option g_perf_cmdline_opts[] = { {"transport-stats", no_argument, NULL, PERF_TRANSPORT_STATISTICS}, #define PERF_IOVA_MODE 258 {"iova-mode", required_argument, NULL, PERF_IOVA_MODE}, +#define PERF_IO_QUEUE_SIZE 259 + {"io-queue-size", required_argument, NULL, PERF_IO_QUEUE_SIZE}, /* Should be the last element */ {0, 0, 0, 0} }; @@ -2314,6 +2321,7 @@ parse_args(int argc, char **argv, struct spdk_env_opts *env_opts) case PERF_RW_MIXREAD: case PERF_NUM_UNUSED_IO_QPAIRS: case PERF_SKIP_ERRORS: + case PERF_IO_QUEUE_SIZE: val = spdk_strtol(optarg, 10); if (val < 0) { fprintf(stderr, "Converting a string to integer failed\n"); @@ -2370,6 +2378,9 @@ parse_args(int argc, char **argv, struct spdk_env_opts *env_opts) } g_io_align_specified = true; break; + case PERF_IO_QUEUE_SIZE: + g_io_queue_size = val; + break; } break; case PERF_ZIPF: @@ -2630,11 +2641,7 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid, return false; } - /* Set io_queue_size to UINT16_MAX, NVMe driver - * will then reduce this to MQES to maximize - * the io_queue_size as much as possible. - */ - opts->io_queue_size = UINT16_MAX; + opts->io_queue_size = g_io_queue_size; /* Set the header and data_digest */ opts->header_digest = g_header_digest;