* [PATCH rdma-next] RDMA/irdma: Add budget to CEQE processing loop
@ 2026-11-26 17:34 Jacob Moroni
2026-11-26 17:39 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Jacob Moroni @ 2026-11-26 17:34 UTC (permalink / raw)
To: tatyana.e.nikolova, jgg, leon; +Cc: linux-rdma, Jacob Moroni
irdma_process_ceq() processes CEQEs until the CEQ is empty and
runs in a tasklet. Under heavy load, CEQEs can be emitted as
fast as they are processed, so the tasklet does not return,
which leads to RCU stalls.
Fix this by implementing a budget in the CEQ handling loop. If
the budget is exhausted, the tasklet is rescheduled, which gives
the kernel a chance to defer to ksoftirqd appropriately.
Fixes: 44d9e52977a1 ("RDMA/irdma: Implement device initialization definitions")
Signed-off-by: Jacob Moroni <jmoroni@google.com>
---
drivers/infiniband/hw/irdma/hw.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/drivers/infiniband/hw/irdma/hw.c b/drivers/infiniband/hw/irdma/hw.c
index 53aa1491c4f6..e71089fd5f56 100644
--- a/drivers/infiniband/hw/irdma/hw.c
+++ b/drivers/infiniband/hw/irdma/hw.c
@@ -166,25 +166,31 @@ static void irdma_process_reserved_ceqe(struct irdma_pci_f *rf,
}
}
+/* CEQEs handled by one run of a CEQ tasklet before it reschedules itself */
+#define IRDMA_CEQ_BUDGET 256
+
/**
* irdma_process_ceq - handle ceq for completions
* @rf: RDMA PCI function
* @ceq: ceq having cq for completion
+ *
+ * Return: True if the CEQ was found empty, false if the budget ran out.
*/
-static void irdma_process_ceq(struct irdma_pci_f *rf, struct irdma_ceq *ceq)
+static bool irdma_process_ceq(struct irdma_pci_f *rf, struct irdma_ceq *ceq)
{
struct irdma_sc_dev *dev = &rf->sc_dev;
+ u32 budget = IRDMA_CEQ_BUDGET;
struct irdma_sc_ceq *sc_ceq;
unsigned long flags;
u32 cq_idx;
sc_ceq = &ceq->sc_ceq;
- do {
+ while (budget--) {
spin_lock_irqsave(&ceq->ce_lock, flags);
if (!irdma_sc_process_ceq(dev, sc_ceq, &cq_idx)) {
spin_unlock_irqrestore(&ceq->ce_lock, flags);
- break;
+ return true;
}
/* Normal CQs must be handled while holding CEQ lock. */
@@ -197,7 +203,9 @@ static void irdma_process_ceq(struct irdma_pci_f *rf, struct irdma_ceq *ceq)
spin_unlock_irqrestore(&ceq->ce_lock, flags);
irdma_process_reserved_ceqe(rf, dev, cq_idx);
- } while (1);
+ }
+
+ return false;
}
static void irdma_set_flush_fields(struct irdma_sc_qp *qp,
@@ -548,10 +556,15 @@ static void irdma_ena_intr(struct irdma_sc_dev *dev, u32 msix_id)
static void irdma_dpc(struct tasklet_struct *t)
{
struct irdma_pci_f *rf = from_tasklet(rf, t, dpc_tasklet);
+ bool ceq_done = true;
if (rf->msix_shared)
- irdma_process_ceq(rf, rf->ceqlist);
+ ceq_done = irdma_process_ceq(rf, rf->ceqlist);
irdma_process_aeq(rf);
+ if (!ceq_done) {
+ tasklet_schedule(&rf->dpc_tasklet);
+ return;
+ }
irdma_ena_intr(&rf->sc_dev, rf->iw_msixtbl[0].idx);
}
@@ -564,7 +577,10 @@ static void irdma_ceq_dpc(struct tasklet_struct *t)
struct irdma_ceq *iwceq = from_tasklet(iwceq, t, dpc_tasklet);
struct irdma_pci_f *rf = iwceq->rf;
- irdma_process_ceq(rf, iwceq);
+ if (!irdma_process_ceq(rf, iwceq)) {
+ tasklet_schedule(&iwceq->dpc_tasklet);
+ return;
+ }
irdma_ena_intr(&rf->sc_dev, iwceq->msix_idx);
}
base-commit: 94e81a1f3ffabb388f7d0a9674bb1d3acc067e00
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH rdma-next] RDMA/irdma: Add budget to CEQE processing loop
2026-11-26 17:34 [PATCH rdma-next] RDMA/irdma: Add budget to CEQE processing loop Jacob Moroni
@ 2026-11-26 17:39 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-26 17:39 UTC (permalink / raw)
To: Jacob Moroni; +Cc: linux-rdma
> irdma_process_ceq() processes CEQEs until the CEQ is empty and
> runs in a tasklet. Under heavy load, CEQEs can be emitted as
> fast as they are processed, so the tasklet does not return,
> which leads to RCU stalls.
>
> Fix this by implementing a budget in the CEQ handling loop. If
> the budget is exhausted, the tasklet is rescheduled, which gives
> the kernel a chance to defer to ksoftirqd appropriately.
>
> Fixes: 44d9e52977a1 ("RDMA/irdma: Implement device initialization definitions")
> Signed-off-by: Jacob Moroni <jmoroni@google.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126173430.2097445-1-jmoroni@google.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-26 17:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 17:34 [PATCH rdma-next] RDMA/irdma: Add budget to CEQE processing loop Jacob Moroni
2026-11-26 17:39 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox