nvme: add NVME_QUIRK_DELAY_AFTER_QUEUE_ALLOC

The VirtualBox emulated NVMe device will intermittently
hang on the first read/write command after an I/O
qpair has been allocated.  The frequency of the hang
diminishes if a delay is added after allocating the I/O
qpair - until it disappears completely with a 100us delay.
So add a quirk to insert this delay.

Note - the 100us delay was tested by running
the hello_world example app 50000 times.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I237e31b1b8a1a1e28262851ae0a21cd7345f0f1a
This commit is contained in:
Jim Harris 2017-04-29 12:21:32 -07:00 committed by Daniel Verkamp
parent 2ba947380f
commit 13f8cf1536
4 changed files with 14 additions and 0 deletions

View File

@ -47,6 +47,7 @@ extern "C" {
#define SPDK_PCI_ANY_ID 0xffff
#define SPDK_PCI_VID_INTEL 0x8086
#define SPDK_PCI_VID_MEMBLAZE 0x1c5f
#define SPDK_PCI_VID_VIRTUALBOX 0x80ee
/**
* PCI class code for NVMe devices.

View File

@ -192,6 +192,10 @@ spdk_nvme_ctrlr_alloc_io_qpair(struct spdk_nvme_ctrlr *ctrlr,
nvme_robust_mutex_unlock(&ctrlr->ctrlr_lock);
if (ctrlr->quirks & NVME_QUIRK_DELAY_AFTER_QUEUE_ALLOC) {
spdk_delay_us(100);
}
return qpair;
}

View File

@ -89,6 +89,12 @@
*/
#define NVME_INTEL_QUIRK_STRIPING 0x8
/*
* The controller needs a delay after allocating an I/O queue pair
* before it is ready to accept I/O commands.
*/
#define NVME_QUIRK_DELAY_AFTER_QUEUE_ALLOC 0x10
#define NVME_MAX_ASYNC_EVENTS (8)
#define NVME_MIN_TIMEOUT_PERIOD (5)

View File

@ -53,6 +53,9 @@ static const struct nvme_quirk nvme_quirks[] = {
{ {SPDK_PCI_VID_MEMBLAZE, 0x0540, SPDK_PCI_ANY_ID, SPDK_PCI_ANY_ID},
NVME_QUIRK_DELAY_BEFORE_CHK_RDY
},
{ {SPDK_PCI_VID_VIRTUALBOX, 0x4e56, SPDK_PCI_ANY_ID, SPDK_PCI_ANY_ID},
NVME_QUIRK_DELAY_AFTER_QUEUE_ALLOC
},
{ {0x0000, 0x0000, 0x0000, 0x0000}, 0}
};