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

nvmf/vfio-user: reduce read barrier costs



There's no need to spdk_rmb() in nvmf_vfio_user_sq_poll() unless we
actually found the tail has advanced.

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


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarThanos Makatos <thanos.makatos@nutanix.com>
parent f89cf818
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -5112,13 +5112,6 @@ nvmf_vfio_user_sq_poll(struct nvmf_vfio_user_sq *sq)
	/* Load-Acquire. */
	new_tail = *sq_dbl_tailp(sq);

	/*
	 * Ensure that changes to the queue are visible to us.
	 * The host driver should write the queue first, do a wmb(), and then
	 * update the SQ tail doorbell (their Store-Release).
	 */
	spdk_rmb();

	new_tail = new_tail & 0xffffu;
	if (spdk_unlikely(new_tail >= sq->size)) {
		union spdk_nvme_async_event_completion event = {};
@@ -5147,6 +5140,13 @@ nvmf_vfio_user_sq_poll(struct nvmf_vfio_user_sq *sq)
			      ctrlr->sdbl->eventidxs[queue_index(sq->qid, false)]);
	}

	/*
	 * Ensure that changes to the queue are visible to us.
	 * The host driver should write the queue first, do a wmb(), and then
	 * update the SQ tail doorbell (their Store-Release).
	 */
	spdk_rmb();

	count = handle_sq_tdbl_write(ctrlr, new_tail, sq);
	if (count < 0) {
		fail_ctrlr(ctrlr);