Spdk/module/bdev/nvme
Shuhei Matsumoto 068ca77ab2 bdev/nvme: Disconnect and then free I/O qpair when deleting ctrlr_channel
For RDMA transport, current synchronous qpair disconnect occupied CPU for
a second when qpair disconnect gets timeout.

To remove this limitation, we will do the following:
- make spdk_nvme_ctrlr_disconnect_io_qpair() asynchronous,
- spdk_nvme_qpair_process_completions() returns -ENXIO only if the
  qpair is actually disconnected.

Even at this patch, spdk_nvme_poll_group_process_completions() invokes
disconnected_qpair_cb only if a qpair is actually disconnected. This
behavior will be maintained.

To use the upcoming asynchronous qpair disconnect easily, when
deleting a ctrlr_channel, disconnect the qpair, and then free the qpair
and release a reference to the poll group when the qpair is actually
disconnected.

We need to delete a nvme_qpair asynchronously after the corresponding
nvme_ctrlr_channel is deleted and defer the deletion of the corresponding
nvme_ctrlr until the nvme_qpair is deleted. To satisfy this requirement,
utilize the reference count of the nvme_ctrlr.

disconnected_qpair_cb() may call spdk_nvme_ctrlr_free_io_qpair() and
spdk_io_device_unregister() successively. The spdk_io_device_unregister()
will execute spdk_nvme_detach_async() from its callback.
spdk_nvme_ctrlr_free_io_qpair() has to complete earlier than
spdk_nvme_detach_async() starts. spdk_nvme_ctrlr_free_io_qpair() is
executed after unwinding stack. spdk_nvme_detach_async() is executed
after sending a message. Sending message is later than unwinding stack.
Hence the requirement is satisfied naturally.

spdk_io_device_unregister() for the nvme_ctrlr is required to be called
on the nvme_ctrlr->thread. To satisfy this requirement, redirect
nvme_ctrlr_unregister() to the nvme_ctrlr->thread. This change is too
small to stand as an independent patch. So include the change in this
patch.

Change-Id: Id8c01966c40b1dae9c4ef17f1b0b3f60a0bd17d5
Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10765
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-03-15 09:05:09 +00:00
..
bdev_nvme_cuse_rpc.c bdev/nvme: Rename nvme_bdev_ctrlr by nvme_ctrlr 2021-07-13 08:57:33 +00:00
bdev_nvme_rpc.c bdev/nvme: Alloc qpair context dynamically on nvme_ctrlr_channel 2022-03-15 09:05:09 +00:00
bdev_nvme.c bdev/nvme: Disconnect and then free I/O qpair when deleting ctrlr_channel 2022-03-15 09:05:09 +00:00
bdev_nvme.h bdev/nvme: Alloc qpair context dynamically on nvme_ctrlr_channel 2022-03-15 09:05:09 +00:00
Makefile so_ver: increase all major versions 2022-01-31 15:29:56 +00:00
nvme_rpc.c bdev/nvme: Remove common.h/common.c 2021-09-08 08:06:39 +00:00
vbdev_opal_rpc.c bdev/nvme: Remove common.h/common.c 2021-09-08 08:06:39 +00:00
vbdev_opal.c bdev/nvme: Use an RB_TREE to hold namespaces in the controller 2021-10-18 07:49:52 +00:00
vbdev_opal.h bdev/nvme: Remove common.h/common.c 2021-09-08 08:06:39 +00:00