Commit 04ee899f authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

nvme: improve probe error handling in MP even further



In cases we probe without a specific trid, the underlying
rte_bus_probe() in spdk_pci_enumerate() might fail to
initialize some devices, but still return with code 0,
That's technically correct, as we asked just to probe
devices on the bus and that's what it did. Some devices might
have been initialized, others not. In secondary process we
blindly assumed all devices were probed successfully, which
might have eventually led to assert failures, as current
process was not on the ctrlr->active_procs list.

To fix it, just add an additional check before attaching
the controller in secondary process.

Change-Id: If015b1e562052a9189ed1a48091b209bd2dd5f2a
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/431727


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 5a588715
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -536,6 +536,11 @@ spdk_nvme_probe_internal(const struct spdk_nvme_transport_id *trid, void *cb_ctx
				continue;
			}

			/* Do not attach if we failed to initialize it in this process */
			if (spdk_nvme_ctrlr_get_current_process(ctrlr) == NULL) {
				continue;
			}

			nvme_ctrlr_proc_get_ref(ctrlr);

			/*
+4 −0
Original line number Diff line number Diff line
@@ -59,6 +59,10 @@ DEFINE_STUB(spdk_pci_device_get_id, struct spdk_pci_id,
DEFINE_STUB(spdk_nvme_transport_available, bool,
	    (enum spdk_nvme_transport_type trtype), true)

/* return anything non-NULL, this won't be deferenced anywhere in this test */
DEFINE_STUB(spdk_nvme_ctrlr_get_current_process, struct spdk_nvme_ctrlr_process *,
	    (struct spdk_nvme_ctrlr *ctrlr), (struct spdk_nvme_ctrlr_process *)(uintptr_t)0x1)

DEFINE_STUB(nvme_ctrlr_add_process, int,
	    (struct spdk_nvme_ctrlr *ctrlr, void *devhandle), 0)

+3 −0
Original line number Diff line number Diff line
@@ -91,6 +91,9 @@ nvme_ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr)
{
}

DEFINE_STUB(spdk_nvme_ctrlr_get_current_process, struct spdk_nvme_ctrlr_process *,
	    (struct spdk_nvme_ctrlr *ctrlr), NULL)

int
nvme_ctrlr_add_process(struct spdk_nvme_ctrlr *ctrlr, void *devhandle)
{
+2 −0
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@ nvme_ctrlr_proc_get_ref(struct spdk_nvme_ctrlr *ctrlr)
	return;
}

DEFINE_STUB(spdk_nvme_ctrlr_get_current_process, struct spdk_nvme_ctrlr_process *,
	    (struct spdk_nvme_ctrlr *ctrlr), NULL)

int
nvme_ctrlr_process_init(struct spdk_nvme_ctrlr *ctrlr)