Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Abhijit Gangurde" <abhijit.gangurde@amd.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [for-next v3 4/5] RDMA/ionic: add Shared receive queue (SRQ) support
Date: Sat, 26 Sep 2026 08:29:01 +0000	[thread overview]
Message-ID: <20260926082902.4776C1F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260925082802.2675902-5-abhijit.gangurde@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] RDMA/ionic: race condition in ionic_modify_srq allows cached limit to diverge from HW limit
--

commit 697ed1cd8f63e63fe464892e9bc1d1c9a1b2de14
Author: Amit Kumar <a.k@amd.com>

RDMA/ionic: add Shared receive queue (SRQ) support

This commit adds Shared receive queue (SRQ) support for the ionic RDMA
driver. It implements the device-supported verb APIs for shared receive
queues, which are currently only supported for userspace.

> diff --git a/drivers/infiniband/hw/ionic/ionic_controlpath.c b/drivers/infiniband/hw/ionic/ionic_controlpath.c
> index 3739c1855a4ba..fd15d9549ac04 100644
> --- a/drivers/infiniband/hw/ionic/ionic_controlpath.c
> +++ b/drivers/infiniband/hw/ionic/ionic_controlpath.c

[ ... ]

> +int ionic_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
> +		     enum ib_srq_attr_mask attr_mask, struct ib_udata *udata)
> +{
> +	struct ionic_ibdev *dev = to_ionic_ibdev(ibsrq->device);
> +	struct ionic_srq *srq = to_ionic_srq(ibsrq);
> +	int rc;
> +
> +	if (attr_mask & IB_SRQ_MAX_WR)
> +		return -EINVAL;
> +
> +	if (attr_mask & IB_SRQ_LIMIT) {
> +		if (attr->srq_limit >= IONIC_MAX_SRQ_LIMIT)
> +			return -EINVAL;
> +
> +		rc = ionic_modify_srq_cmd(dev, srq->rq.qid, attr->srq_limit);
> +		if (rc)
> +			return rc;
> +
> +		srq->srq_limit = attr->srq_limit;

[Severity: Medium]
Does this code allow the cached SRQ limit to diverge from the hardware
limit due to a race condition?

In drivers/infiniband/hw/ionic/ionic_controlpath.c, ionic_modify_srq() is
called to update the SRQ limit. The IB core allows concurrent readers via
uobj_get_obj_read(), meaning multiple userspace threads can invoke this
function on the same SRQ object simultaneously.

Because there is no driver-level locking around the hardware command and
the subsequent state update, these operations can interleave. This can result
in the hardware being programmed with one limit while the driver caches a
different limit, causing ibv_query_srq() to return incorrect state to the
user application.

Could a lock be used to protect the SRQ limit modification sequence?

> +	}
> +
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260925082802.2675902-1-abhijit.gangurde@amd.com?part=4

  reply	other threads:[~2026-09-26  8:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25  8:27 [for-next v3 0/5] RDMA/ionic: add SRQ support and firmware assigned CQ and SRQ IDs Abhijit Gangurde
2026-09-25  8:27 ` [for-next v3 1/5] net: ionic: Fetch qid allocation and SRQ capability from firmware Abhijit Gangurde
2026-09-26  8:29   ` sashiko-bot
2026-09-29 23:30   ` patchwork-bot+netdevbpf
2026-09-25  8:27 ` [for-next v3 2/5] RDMA/ionic: support firmware-assigned CQ IDs Abhijit Gangurde
2026-09-26  8:29   ` sashiko-bot
2026-09-25  8:28 ` [for-next v3 3/5] RDMA/ionic: segregate rq related fields from ionic_qp into a new ionic_rq struct Abhijit Gangurde
2026-09-26  8:29   ` sashiko-bot
2026-09-25  8:28 ` [for-next v3 4/5] RDMA/ionic: add Shared receive queue (SRQ) support Abhijit Gangurde
2026-09-26  8:29   ` sashiko-bot [this message]
2026-09-25  8:28 ` [for-next v3 5/5] RDMA/ionic: implement SRQ event handling support Abhijit Gangurde
2026-09-26  8:29   ` sashiko-bot
2026-09-29 18:58 ` [for-next v3 0/5] RDMA/ionic: add SRQ support and firmware assigned CQ and SRQ IDs Leon Romanovsky
2026-09-29 23:21   ` Jakub Kicinski
2026-09-30 13:11     ` 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=20260926082902.4776C1F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=abhijit.gangurde@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox