nvme: add quirk for a minimum io queue size

Some version of firmware on Intel SSDs exhibit poor performance
with an IO queue size of 256 (the SPDK default).  Add a quirk to
account for this - and use the same size as the Linux driver (1024)
instead.

If the user specified a controller option to explicitly set the
io_queue_size different than the default, the quirk will not take
effect.  Note that users can still override the io_queue_size when
creating the qpair - this only changes the ctrlr's default
io_queue_size.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iff0f7ab9856fc18f226f7171e5109bb8fe430969

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/432227
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Jim Harris 2018-11-06 07:47:40 -07:00 committed by Tomasz Zawadzki
parent a7b6702d6f
commit 7843321065
3 changed files with 27 additions and 4 deletions

View File

@ -431,6 +431,15 @@ nvme_ctrlr_probe(const struct spdk_nvme_transport_id *trid,
ctrlr->remove_cb = probe_ctx->remove_cb;
ctrlr->cb_ctx = probe_ctx->cb_ctx;
if (ctrlr->quirks & NVME_QUIRK_MINIMUM_IO_QUEUE_SIZE &&
ctrlr->opts.io_queue_size == DEFAULT_IO_QUEUE_SIZE) {
/* If the user specifically set an IO queue size different than the
* default, use that value. Otherwise overwrite with the quirked value.
* This allows this quirk to be overridden when necessary.
*/
ctrlr->opts.io_queue_size = DEFAULT_IO_QUEUE_SIZE_FOR_QUIRK;
}
nvme_qpair_set_state(ctrlr->adminq, NVME_QPAIR_ENABLED);
TAILQ_INSERT_TAIL(&probe_ctx->init_ctrlrs, ctrlr, tailq);
return 0;

View File

@ -129,6 +129,15 @@ extern pid_t g_spdk_nvme_pid;
*/
#define NVME_QUIRK_DELAY_BEFORE_INIT 0x400
/*
* Some SSDs exhibit poor performance with the default SPDK NVMe IO queue size.
* This quirk will increase the default to 1024 which matches other operating
* systems, at the cost of some extra memory usage. Users can still override
* the increased default by changing the spdk_nvme_io_qpair_opts when allocating
* a new queue pair.
*/
#define NVME_QUIRK_MINIMUM_IO_QUEUE_SIZE 0x800
#define NVME_MAX_ASYNC_EVENTS (8)
#define NVME_MAX_ADMIN_TIMEOUT_IN_SECS (30)
@ -143,6 +152,7 @@ extern pid_t g_spdk_nvme_pid;
*/
#define DEFAULT_MAX_IO_QUEUES (1024)
#define DEFAULT_IO_QUEUE_SIZE (256)
#define DEFAULT_IO_QUEUE_SIZE_FOR_QUIRK (1024) /* Matches Linux kernel driver */
#define DEFAULT_ADMIN_QUEUE_REQUESTS (32)
#define DEFAULT_IO_QUEUE_REQUESTS (512)

View File

@ -44,26 +44,30 @@ static const struct nvme_quirk nvme_quirks[] = {
NVME_INTEL_QUIRK_WRITE_LATENCY |
NVME_INTEL_QUIRK_STRIPING |
NVME_QUIRK_READ_ZERO_AFTER_DEALLOCATE |
NVME_QUIRK_DELAY_BEFORE_INIT
NVME_QUIRK_DELAY_BEFORE_INIT |
NVME_QUIRK_MINIMUM_IO_QUEUE_SIZE
},
{ {SPDK_PCI_VID_INTEL, 0x0A53, SPDK_PCI_ANY_ID, SPDK_PCI_ANY_ID},
NVME_INTEL_QUIRK_READ_LATENCY |
NVME_INTEL_QUIRK_WRITE_LATENCY |
NVME_INTEL_QUIRK_STRIPING |
NVME_QUIRK_READ_ZERO_AFTER_DEALLOCATE |
NVME_QUIRK_DELAY_BEFORE_INIT
NVME_QUIRK_DELAY_BEFORE_INIT |
NVME_QUIRK_MINIMUM_IO_QUEUE_SIZE
},
{ {SPDK_PCI_VID_INTEL, 0x0A54, SPDK_PCI_ANY_ID, SPDK_PCI_ANY_ID},
NVME_INTEL_QUIRK_READ_LATENCY |
NVME_INTEL_QUIRK_WRITE_LATENCY |
NVME_INTEL_QUIRK_STRIPING |
NVME_QUIRK_READ_ZERO_AFTER_DEALLOCATE
NVME_QUIRK_READ_ZERO_AFTER_DEALLOCATE |
NVME_QUIRK_MINIMUM_IO_QUEUE_SIZE
},
{ {SPDK_PCI_VID_INTEL, 0x0A55, SPDK_PCI_ANY_ID, SPDK_PCI_ANY_ID},
NVME_INTEL_QUIRK_READ_LATENCY |
NVME_INTEL_QUIRK_WRITE_LATENCY |
NVME_INTEL_QUIRK_STRIPING |
NVME_QUIRK_READ_ZERO_AFTER_DEALLOCATE
NVME_QUIRK_READ_ZERO_AFTER_DEALLOCATE |
NVME_QUIRK_MINIMUM_IO_QUEUE_SIZE
},
{ {SPDK_PCI_VID_MEMBLAZE, 0x0540, SPDK_PCI_ANY_ID, SPDK_PCI_ANY_ID},
NVME_QUIRK_DELAY_BEFORE_CHK_RDY