RDMA/irdma: Bound in-flight CQP ops across deferred completions
Subsystems (2)
PATCH 1/1 RDMA/irdma: Bound in-flight CQP ops across deferred completions
On IRDMA_GEN_3+ devices, CQP operations can complete in two stages:
Stage-1 on the CCQ acknowledges receipt and moves an entry from cqp->ooo_avail to cqp->ooo_pnd, while Stage-2 signals final completion via an AEQ event or a subsequent CCQ CQE.
In irdma_sc_ccq_get_cqe_info(), Stage-1 processing advances cqp->sq_ring.tail so the SQ descriptor slot can be reused once consumed by hardware, whereas cqp->completed_ops is only incremented on Stage-2. Because irdma_cqp_ring_full() only checks cqp->sq_ring, a burst of backlogged commands in dev->cqp_cmd_head allows irdma_process_bh() to submit more concurrent in-flight CQP commands than the maximum supported limit (cqp->sq_size - 1) while earlier commands await Stage-2. This causes CQP completions to be lost and synchronous waiters to time out with -ETIMEDOUT (-110).
Fix this by:
- Updating irdma_cqp_ring_full() to bound total in-flight CQP
operations (cqp->requested_ops - cqp->completed_ops) to
(cqp->sq_size - 1). - Calling irdma_process_bh() at the end of irdma_process_ae_def_cmpl() so backlogged commands are drained after Stage-2 AEQ completions increment cqp->completed_ops and free in-flight capacity.
--- drivers/infiniband/hw/irdma/ctrl.c | 6 +++++- drivers/infiniband/hw/irdma/hw.c | 1 + 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/infiniband/hw/irdma/ctrl.c +5 -1
@@ -5331,7 +5331,11 @@ int irdma_sc_static_hmc_pages_allocated(struct irdma_sc_cqp *cqp, u64 scratch,*/ static bool irdma_cqp_ring_full (struct irdma_sc_cqp *cqp) { -return IRDMA_RING_FULL_ERR (cqp->sq_ring); +u64 in_flight = cqp->requested_ops - +atomic64_read (&cqp->completed_ops); + +return IRDMA_RING_FULL_ERR (cqp->sq_ring) || + in_flight >= (cqp->sq_size -1 ); }/**
drivers/infiniband/hw/irdma/hw.c +1 -0
@@ -265,6 +265,7 @@ static void irdma_process_ae_def_cmpl(struct irdma_pci_f *rf,irdma_sc_cqp_def_cmpl_ae_handler (&rf->sc_dev, info, false, &scratch, &sw_def_info); } +irdma_process_bh (&rf->sc_dev); }/**
Signature · 1 line
2.56.0.176.g3575e65682-goog
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 19 lines
On IRDMA_GEN_3+ devices, CQP operations can complete in two stages:
Stage-1 on the CCQ acknowledges receipt and moves an entry fromcqp->ooo_availtocqp->ooo_pnd, while Stage-2 signals final completion via an AEQ event or a subsequent CCQ CQE.In
irdma_sc_ccq_get_cqe_info(), Stage-1 processing advancescqp->sq_ring.tailso the SQ descriptor slot can be reused once consumed by hardware, whereascqp->completed_opsis only incremented on Stage-2. Becauseirdma_cqp_ring_full()only checkscqp->sq_ring, a burst of backlogged commands indev->cqp_cmd_headallowsirdma_process_bh()to submit more concurrent in-flight CQP commands than the maximum supported limit (cqp->sq_size- 1) while earlier commands await Stage-2. This causes CQP completions to be lost and synchronous waiters to time out with-ETIMEDOUT(-110).Fix this by:
- Updatingirdma_cqp_ring_full()to bound total in-flight CQPoperations (cqp->requested_ops - cqp->completed_ops) to (cqp->sq_size - 1).
Quoted 7 lines
- Calling
irdma_process_bh()at the end ofirdma_process_ae_def_cmpl()so backlogged commands are drained after Stage-2 AEQ completions incrementcqp->completed_opsand free in-flight capacity.Fixes c7db0abe5f2b ("RDMA/irdma: Add GEN3 CQP support with deferred completions")Assisted-by GeminiSigned-off-by Sunny Tiwari <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Leon Romanovsky
AppliedQuoted 15 lines · Sunny Tiwari
On IRDMA_GEN_3+ devices, CQP operations can complete in two stages:
Stage-1 on the CCQ acknowledges receipt and moves an entry fromcqp->ooo_availtocqp->ooo_pnd, while Stage-2 signals final completion via an AEQ event or a subsequent CCQ CQE.In
irdma_sc_ccq_get_cqe_info(), Stage-1 processing advancescqp->sq_ring.tailso the SQ descriptor slot can be reused once consumed by hardware, whereascqp->completed_opsis only incremented on Stage-2. Becauseirdma_cqp_ring_full()only checkscqp->sq_ring, a burst of backlogged commands indev->cqp_cmd_headallowsirdma_process_bh()to submit more concurrent in-flight CQP commands than the maximum supported limit (cqp->sq_size- 1) while earlier commands await Stage-2. This causes CQP completions to be lost and synchronous waiters to time out with-ETIMEDOUT(-110).
Quoted 1 line
[...]
Applied, thanks!
[1/1] RDMA/irdma: Bound in-flight CQP ops across deferred completions
https://git.kernel.org/rdma/rdma/c/c3e8e9451e6f1b
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>