Commit 223a87b0 authored by Jim Harris's avatar Jim Harris
Browse files

test/nvme: make reset test exit 0 on QEMU SSDs



There are some QEMU bugs with resets for NVMe emulation.
It simply hasn't been tested for this test's very
stressful reset scenarios.

Since this test is failing the nightly builds fairly
regularly on VMs, just have this test print an
error message and exit 0 when it finds a QEMU SSD.

This will also allow us to enable this test per-patch
in a future patch.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I1013f1d84ab4d0e13f713fe99352b011d77dd1f8

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454517


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 2ff59b0e
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include "spdk/nvme.h"
#include "spdk/env.h"
#include "spdk/string.h"
#include "spdk/pci_ids.h"

struct ctrlr_entry {
	struct spdk_nvme_ctrlr	*ctrlr;
@@ -81,6 +82,7 @@ static struct ctrlr_entry *g_controllers = NULL;
static struct ns_entry *g_namespaces = NULL;
static int g_num_namespaces = 0;
static struct worker_thread *g_workers = NULL;
static bool g_qemu_ssd_found = false;

static uint64_t g_tsc_rate;

@@ -526,6 +528,22 @@ static void
attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
	  struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{
	if (trid->trtype == SPDK_NVME_TRANSPORT_PCIE) {
		struct spdk_pci_device *dev = spdk_nvme_ctrlr_get_pci_device(ctrlr);

		/* QEMU emulated SSDs can't handle this test, so we will skip
		 *  them.  QEMU NVMe SSDs report themselves as VID == Intel.  So we need
		 *  to check this specific 0x5845 device ID to know whether it's QEMU
		 *  or not.
		 */
		if (spdk_pci_device_get_vendor_id(dev) == SPDK_PCI_VID_INTEL &&
		    spdk_pci_device_get_device_id(dev) == 0x5845) {
			g_qemu_ssd_found = true;
			printf("Skipping QEMU NVMe SSD at %s\n", trid->traddr);
			return;
		}
	}

	register_ctrlr(ctrlr);
}

@@ -657,7 +675,7 @@ int main(int argc, char **argv)

	if (!g_controllers) {
		printf("No NVMe controller found, %s exiting\n", argv[0]);
		return 1;
		return g_qemu_ssd_found ? 0 : 1;
	}

	task_pool = spdk_mempool_create("task_pool", TASK_POOL_NUM,