From: Jacob Moroni <jmoroni@google.com>
To: tatyana.e.nikolova@intel.com, jgg@ziepe.ca, leon@kernel.org
Cc: linux-rdma@vger.kernel.org, Jacob Moroni <jmoroni@google.com>
Subject: [PATCH rdma-next] RDMA/irdma: Add budget to CEQE processing loop
Date: Thu, 26 Nov 2026 17:34:30 +0000 [thread overview]
Message-ID: <20261126173430.2097445-1-jmoroni@google.com> (raw)
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
next reply other threads:[~2026-11-26 17:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 17:34 Jacob Moroni [this message]
2026-11-26 17:39 ` [PATCH rdma-next] RDMA/irdma: Add budget to CEQE processing loop sashiko-bot
2026-11-27 15:56 ` Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126173430.2097445-1-jmoroni@google.com \
--to=jmoroni@google.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=tatyana.e.nikolova@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.