Commit 4bcab9fb authored by John Levon's avatar John Levon Committed by Konrad Sztyber
Browse files

correct kick for CQ full case



We implement basic flow control by not processing any submissions while
the CQ is full. However, in interrupt mode, the code was mistakenly
attempting to kick ctrlr->intr_fd - this will not go well, as this is
the vfio-user socket fd, not an eventfd. It should be kicking the SQ
group's eventfd.

Fixes: 23b518a0 ("nvmf/vfio_user: mitigate cq full race")
Signed-off-by: default avatarJohn Levon <john.levon@nutanix.com>
Change-Id: Ia3b5ad8ffe4118a620fc3894e40fc95c251cd009
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/25401


Reviewed-by: default avatarChangpeng Liu <changpeliu@tencent.com>
Community-CI: Mellanox Build Bot
Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
parent 8531656d
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -662,6 +662,13 @@ ctrlr_to_poll_group(struct nvmf_vfio_user_ctrlr *vu_ctrlr)
				group);
}

static inline struct nvmf_vfio_user_poll_group *
sq_to_poll_group(struct nvmf_vfio_user_sq *sq)
{
	return SPDK_CONTAINEROF(sq->group, struct nvmf_vfio_user_poll_group,
				group);
}

static inline struct spdk_thread *
poll_group_to_thread(struct nvmf_vfio_user_poll_group *vu_pg)
{
@@ -2587,7 +2594,8 @@ handle_sq_tdbl_write(struct nvmf_vfio_user_ctrlr *ctrlr, const uint32_t new_tail
			 * sq head is advanced only for consumed commands.
			 */
			if (in_interrupt_mode(ctrlr->transport)) {
				eventfd_write(ctrlr->intr_fd, 1);
				struct nvmf_vfio_user_poll_group *vu_group = sq_to_poll_group(sq);
				eventfd_write(vu_group->intr_fd, 1);
			}
			break;
		}