From: sashiko-bot@kernel.org
To: "Abhijit Gangurde" <abhijit.gangurde@amd.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [for-next v4 3/4] RDMA/ionic: Accept CQ ring buffers as ioctl umem attributes
Date: Thu, 03 Dec 2026 11:31:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-247671@kernel.org> (raw)
In-Reply-To: <20261203110805.2577721-4-abhijit.gangurde@amd.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] RDMA/ionic: missing dma-buf SG alignment check in
ionic_cq_get_user_umem()
- [Low] RDMA/ionic: unimplemented UAPI comp_mask bits added in
ionic-abi.h
- [Low] RDMA/ionic: ionic_alloc_ucontext() sets CQ/QP umem flag before
QP support
- [Low] RDMA/ionic: add unused, undocumented UAPI comp_mask flags in
ionic-abi.h
--
commit e6e85a53b2db04807e567070469fd5988b9bfc26
Author: Abhijit Gangurde <abhijit.gangurde@amd.com>
RDMA/ionic: Accept CQ ring buffers as ioctl umem attributes
This commit allows userspace to pass per-UDMA CQ ring buffers as ioctl umem
attributes via ib_umem_get_attr() and advertises support with
IONIC_CTX_CMASK_CQ_QP_BUF_UMEM in the ucontext response.
> diff --git a/drivers/infiniband/hw/ionic/ionic_controlpath.c b/drivers/infiniband/hw/ionic/ionic_controlpath.c
> index 3abb8c01daf6b..c3a47aa108e44 100644
> --- a/drivers/infiniband/hw/ionic/ionic_controlpath.c
> +++ b/drivers/infiniband/hw/ionic/ionic_controlpath.c
> @@ -76,23 +76,42 @@ static void ionic_put_cqid(struct ionic_ibdev *dev, u32 cqid)
[ ... ]
> - umem = ib_umem_get_cq_buf_or_va(&dev->ibdev, NULL, req_cq->addr,
> - req_cq->size, IB_ACCESS_LOCAL_WRITE);
> + umem = ib_umem_get_attr(&dev->ibdev, attrs,
> + ionic_cq_buf_attrs[udma_idx], req_cq->size,
> + IB_ACCESS_LOCAL_WRITE);
> if (IS_ERR(umem))
> return PTR_ERR(umem);
>
> - /* The ring is given to the device as whole pages */
> - if (ib_umem_offset(umem)) {
> + if (!umem) {
> + umem = ib_umem_get_cq_buf_or_va(&dev->ibdev, NULL,
> + req_cq->addr, req_cq->size,
> + IB_ACCESS_LOCAL_WRITE);
> + if (IS_ERR(umem))
> + return PTR_ERR(umem);
> + }
> +
> + /* The device is given whole pages, and only those of the ring */
> + if (umem->length != req_cq->size || ib_umem_offset(umem)) {
> ib_umem_release(umem);
> return -EINVAL;
> }
[Severity: High]
Does this validate scatterlist DMA alignment and contiguity for dma-buf CQ
rings?
ib_umem_get_attr() can return a dma-buf umem, where ib_umem_offset() only
checks the logical byte offset in the dma-buf rather than the scatterlist
DMA addresses or interior segment boundaries. When a dma-buf exporter
produces scatterlist entries not aligned to host PAGE_SIZE (for example,
4KB-aligned GPU VRAM on a 16KB or 64KB PAGE_SIZE host),
ionic_create_cq_common() passes cq->umem straight to
ionic_pgtbl_init(..., PAGE_SIZE).
In ionic_pgtbl_umem(), rdma_umem_for_each_dma_block() masks unaligned DMA
addresses down to PAGE_SIZE and collapses discontinuous sub-PAGE_SIZE
segments into one entry, causing the NIC to DMA-write CQEs outside the
exported dma-buf. Validating the umem with ib_umem_find_best_pgsz(), as
ionic_reg_user_mr_dmabuf() does, would reject unaligned or discontinuous
scatterlists.
[ ... ]
> @@ -448,7 +468,8 @@ int ionic_alloc_ucontext(struct ib_ucontext *ibctx, struct ib_udata *udata)
> resp.udma_count = dev->lif_cfg.udma_count;
> resp.expdb_mask = dev->lif_cfg.expdb_mask;
> resp.rcq_sign_bit = dev->lif_cfg.rcq_sign_bit;
> - resp.comp_mask |= IONIC_CTX_CMASK_IONIC_FLAGS;
> + resp.comp_mask |= IONIC_CTX_CMASK_IONIC_FLAGS |
> + IONIC_CTX_CMASK_CQ_QP_BUF_UMEM;
>
> if (dev->lif_cfg.sq_expdb)
> resp.expdb_qtypes |= IONIC_EXPDB_SQ;
[Severity: Low]
Should IONIC_CTX_CMASK_CQ_QP_BUF_UMEM wait until QP ring umem attributes
are handled?
At this commit, UVERBS_METHOD_QP_CREATE in the RDMA core already accepts
optional UVERBS_ATTR_CREATE_QP_SQ_BUF_UMEM and
UVERBS_ATTR_CREATE_QP_RQ_BUF_UMEM attributes, so a userspace provider that
trusts IONIC_CTX_CMASK_CQ_QP_BUF_UMEM will reach ionic_create_qp(). Since
ionic_get_user_q_umem() still ignores those attributes and pins q->addr via
ib_umem_get_va(), QP creation fails with -EFAULT when q->addr is zero.
QP SQ and RQ umem attribute handling is added in the following patch,
commit "RDMA/ionic: Accept QP SQ and RQ rings as ioctl umem attributes", so
deferring this flag to that commit would keep the series bisectable.
[ ... ]
> diff --git a/include/uapi/rdma/ionic-abi.h b/include/uapi/rdma/ionic-abi.h
> index ac48fcd19a4f7..f499f083059c6 100644
> --- a/include/uapi/rdma/ionic-abi.h
> +++ b/include/uapi/rdma/ionic-abi.h
> @@ -24,6 +24,9 @@
>
> enum ionic_ctx_resp_comp_mask {
> IONIC_CTX_CMASK_IONIC_FLAGS = 1 << 0,
> + IONIC_CTX_CMASK_UDP_SPORT = 1 << 1,
> + IONIC_CTX_CMASK_CQ_NOTIFY_IOCTL = 1 << 2,
> + IONIC_CTX_CMASK_CQ_QP_BUF_UMEM = 1 << 3,
> };
>
> struct ionic_ctx_req {
[Severity: Low]
Are IONIC_CTX_CMASK_UDP_SPORT and IONIC_CTX_CMASK_CQ_NOTIFY_IOCTL meant to
be added here?
Neither flag is set or referenced anywhere in drivers/infiniband/hw/ionic/
through the end of the series, and the commit message does not mention
them. Since UAPI enum names become permanent ABI once merged,
unimplemented enumerators should be omitted; if bits 1 and 2 must remain
skipped for userspace ABI compatibility, noting that in the commit message
without exposing unimplemented names would avoid dead UAPI symbols.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203110805.2577721-1-abhijit.gangurde@amd.com?part=3
next prev parent reply other threads:[~2026-12-03 11:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 11:08 [for-next v4 0/4] RDMA/ionic: Accept CQ, SQ, and RQ rings as umem attributes Abhijit Gangurde
2026-12-03 11:08 ` [for-next v4 1/4] RDMA/ionic: Bound user queue depth and stride before shifting Abhijit Gangurde
2026-12-03 11:08 ` [for-next v4 2/4] RDMA/ionic: Check user ring alignment on the pinned umem Abhijit Gangurde
2026-12-03 11:08 ` [for-next v4 3/4] RDMA/ionic: Accept CQ ring buffers as ioctl umem attributes Abhijit Gangurde
2026-12-03 11:31 ` sashiko-bot [this message]
2026-12-03 11:08 ` [for-next v4 4/4] RDMA/ionic: Accept QP SQ and RQ rings " Abhijit Gangurde
2026-12-03 11:32 ` sashiko-bot
2026-12-03 11:32 ` [for-next v4 0/4] RDMA/ionic: Accept CQ, SQ, and RQ rings as " sashiko-bot
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-247671@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