From: sashiko-bot@kernel.org
To: "Konstantin Taranov" <kotaranov@linux.microsoft.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next v10 9/9] RDMA/mana_ib: Handle error CQEs for kernel QPs
Date: Wed, 11 Nov 2026 13:47:35 +0000 [thread overview]
Message-ID: <sashiko-outbox-209110@kernel.org> (raw)
In-Reply-To: <20261111121417.1265896-10-kotaranov@linux.microsoft.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] RDMA/mana_ib: race in mana_remove_qp_from_cqs() when send_cq
== recv_cq
--
commit a21cd9814010904d171e9602dc8b61668d553074
Author: Konstantin Taranov <kotaranov@microsoft.com>
RDMA/mana_ib: Handle error CQEs for kernel QPs
This commit decodes hardware error CQEs on kernel QPs, defers moving
failing QPs to the ERR state via a work item, and cleans pending CQEs on
QP reset.
> diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
> index c021e58817628..837e5c46ed778 100644
> --- a/drivers/infiniband/hw/mana/qp.c
> +++ b/drivers/infiniband/hw/mana/qp.c
[ ... ]
> @@ -774,15 +777,19 @@ static void mana_remove_qp_from_cqs(struct mana_ib_qp *qp, bool reset)
> list_del_init(&qp->send_err_node);
> /* Keep shadow reset serialized with hardware polling and SW flushing. */
> if (reset) {
> + mana_ib_cq_clean(send_cq, qp);
> reset_shadow_queue(&qp->shadow_sq);
> reset_shadow_queue(&qp->shadow_mmq);
> }
> spin_unlock_irqrestore(&send_cq->cq_lock, flags);
>
> spin_lock_irqsave(&recv_cq->cq_lock, flags);
> list_del_init(&qp->recv_err_node);
> - if (reset)
> + if (reset) {
> + if (recv_cq != send_cq)
> + mana_ib_cq_clean(recv_cq, qp);
> reset_shadow_queue(&qp->shadow_rq);
> + }
> spin_unlock_irqrestore(&recv_cq->cq_lock, flags);
> }
[Severity: Medium]
When send_cq == recv_cq, can a concurrent mana_ib_poll_cq() between these
two critical sections flush receive shadow WQEs whose hardware CQEs were
already invalidated?
mana_ib_cq_clean() checks mana_ib_cqe_matches_qp() using cqe_info.is_sq,
so the first call invalidates both SQ and RQ CQEs for qp in the shared CQ.
Dropping cq_lock before unlinking qp->recv_err_node and resetting
qp->shadow_rq opens a window for mana_ib_poll_cq():
CPU0 CPU1
mana_remove_qp_from_cqs(qp, true)
spin_lock(&cq->cq_lock)
list_del_init(&qp->send_err_node)
mana_ib_cq_clean(cq, qp)
/* invalidates SQ and RQ CQEs */
reset_shadow_queue(&qp->shadow_sq)
reset_shadow_queue(&qp->shadow_mmq)
spin_unlock(&cq->cq_lock)
mana_ib_poll_cq()
spin_lock(&cq->cq_lock)
mana_poll_cqe()
/* skips invalidated RQ CQEs */
mana_flush_completions()
/* flushes qp->shadow_rq as
* IB_WC_WR_FLUSH_ERR */
spin_unlock(&cq->cq_lock)
spin_lock(&cq->cq_lock)
list_del_init(&qp->recv_err_node)
reset_shadow_queue(&qp->shadow_rq)
spin_unlock(&cq->cq_lock)
If recv_cq == send_cq, unlinking qp->recv_err_node and resetting
qp->shadow_rq inside the first critical section (and skipping the second
lock acquisition) would keep the CQ clean and shadow queue resets atomic.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261111121417.1265896-1-kotaranov@linux.microsoft.com?part=9
next prev parent reply other threads:[~2026-11-11 13:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 12:14 [PATCH rdma-next v10 0/9] RDMA/mana_ib: Add kernel RC and fast registration support Konstantin Taranov
2026-11-11 12:14 ` [PATCH rdma-next v10 1/9] RDMA/mana_ib: Allocate and map fast-registration MRs Konstantin Taranov
2026-11-11 12:38 ` sashiko-bot
2026-11-11 12:14 ` [PATCH rdma-next v10 2/9] RDMA/mana: Create and destroy kernel RC QPs Konstantin Taranov
2026-11-11 12:48 ` sashiko-bot
2026-11-11 12:14 ` [PATCH rdma-next v10 3/9] net/mana: Extend GDMA encoding for new RDMA WQEs Konstantin Taranov
2026-11-11 12:48 ` sashiko-bot
2026-11-11 12:14 ` [PATCH rdma-next v10 4/9] RDMA/mana_ib: Maintain kernel RC QP state Konstantin Taranov
2026-11-11 12:56 ` sashiko-bot
2026-11-11 12:14 ` [PATCH rdma-next v10 5/9] RDMA/mana_ib: Post receive WRs on kernel RC QPs Konstantin Taranov
2026-11-11 12:59 ` sashiko-bot
2026-11-11 12:14 ` [PATCH rdma-next v10 6/9] RDMA/mana_ib: Post send and memory-management WRs on " Konstantin Taranov
2026-11-11 13:07 ` sashiko-bot
2026-11-11 12:14 ` [PATCH rdma-next v10 7/9] RDMA/mana_ib: Poll RC completions using PSN and FSN progress Konstantin Taranov
2026-11-11 13:25 ` sashiko-bot
2026-11-11 16:48 ` Konstantin Taranov
2026-11-11 12:14 ` [PATCH rdma-next v10 8/9] RDMA/mana_ib: Flush and notify CQs when kernel QPs enter ERR Konstantin Taranov
2026-11-11 13:20 ` sashiko-bot
2026-11-11 12:14 ` [PATCH rdma-next v10 9/9] RDMA/mana_ib: Handle error CQEs for kernel QPs Konstantin Taranov
2026-11-11 13:47 ` sashiko-bot [this message]
2026-11-11 16:46 ` Konstantin Taranov
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=sashiko-outbox-209110@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kotaranov@linux.microsoft.com \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.