Commit 2eaae37d authored by John Levon's avatar John Levon Committed by Tomasz Zawadzki
Browse files

nvmf/vfio-user: complete queue deletion on correct thread



If the queue was on another poll group, we need to send a message back
to the admin CQ's thread to post the completion from the correct
context.

Signed-off-by: default avatarJohn Levon <john.levon@nutanix.com>
Change-Id: I997987d5d6b822a1a5124f54fc29ce5d7f03190d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14057


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarSwapnil Ingle <swapnil.ingle@nutanix.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
parent e93ba047
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -1624,6 +1624,10 @@ post_completion(struct nvmf_vfio_user_ctrlr *ctrlr, struct nvmf_vfio_user_cq *cq
		return 0;
	}

	if (cq->qid == 0) {
		assert(spdk_get_thread() == cq->thread);
	}

	if (cq_is_full(cq)) {
		SPDK_ERRLOG("%s: cqid:%d full (tail=%d, head=%d)\n",
			    ctrlr_id(ctrlr), cq->qid, *cq_tailp(cq),
@@ -2117,11 +2121,20 @@ vfio_user_qpair_delete_cb(void *cb_arg)
{
	struct vfio_user_delete_sq_ctx *ctx = cb_arg;
	struct nvmf_vfio_user_ctrlr *vu_ctrlr = ctx->vu_ctrlr;
	struct nvmf_vfio_user_cq *admin_cq = vu_ctrlr->cqs[0];

	post_completion(vu_ctrlr, vu_ctrlr->cqs[0], 0, 0, ctx->delete_io_sq_cmd.cid,
	if (admin_cq->thread != spdk_get_thread()) {
		assert(admin_cq->thread != NULL);
		spdk_thread_send_msg(admin_cq->thread,
				     vfio_user_qpair_delete_cb,
				     cb_arg);
	} else {
		post_completion(vu_ctrlr, vu_ctrlr->cqs[0], 0, 0,
				ctx->delete_io_sq_cmd.cid,
				SPDK_NVME_SC_SUCCESS, SPDK_NVME_SCT_GENERIC);
		free(ctx);
	}
}

/*
 * Deletes a completion or submission I/O queue.