Commit ce6171d4 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Tomasz Zawadzki
Browse files

lib/vmd: detach devices during shutdown



Added spdk_vmd_fini(), which detaches all PCI devices acquired by the
VMD subsystem.

Fixes #1148

Change-Id: I43218ef5f9a764546b655c28688897fb91b779cb
Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482852


Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent aaa9630a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2,6 +2,10 @@

## v20.04: (Upcoming Release)

### vmd
A new function, `spdk_vmd_fini`, has been added. It releases all resources acquired by the VMD
library through the `spdk_vmd_init` call.

## v20.01

### bdev
+2 −0
Original line number Diff line number Diff line
@@ -117,5 +117,7 @@ main(int argc, char **argv)
		dev = spdk_pci_get_next_device(dev);
	}

	spdk_vmd_fini();

	return 0;
}
+5 −0
Original line number Diff line number Diff line
@@ -934,6 +934,7 @@ static void spdk_fio_cleanup(struct thread_data *td)
{
	struct spdk_fio_thread	*fio_thread = td->io_ops_data;
	struct spdk_fio_qpair	*fio_qpair, *fio_qpair_tmp;
	struct spdk_fio_options *fio_options = td->eo;

	fio_qpair = fio_thread->fio_qpair;
	while (fio_qpair != NULL) {
@@ -959,6 +960,10 @@ static void spdk_fio_cleanup(struct thread_data *td)
			fio_ctrlr = fio_ctrlr_tmp;
		}
		g_ctrlr = NULL;

		if (fio_options->enable_vmd) {
			spdk_vmd_fini();
		}
	}
	pthread_mutex_unlock(&g_mutex);
	if (!g_ctrlr) {
+4 −0
Original line number Diff line number Diff line
@@ -426,5 +426,9 @@ int main(int argc, char **argv)
	printf("Initialization complete.\n");
	hello_world();
	cleanup();
	if (g_vmd) {
		spdk_vmd_fini();
	}

	return 0;
}
+4 −0
Original line number Diff line number Diff line
@@ -1817,5 +1817,9 @@ int main(int argc, char **argv)
		fprintf(stderr, "No NVMe controllers found.\n");
	}

	if (g_vmd) {
		spdk_vmd_fini();
	}

	return 0;
}
Loading