From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796297467; b=W+oRrAB2XF+EpK1tSLNpSe9gdnA/g4E/tCz484g0t/gTtbXoxGxsY9gIDdHvunYlN7yU x9wP4odt/oe68d8s6pJ3PjllhjMPxyOppB5A6wsWQMIqwKsQDEFnWo6UG0aP08p1Htmrm KPPzamKkHKPpiYO6viPBWtBIIwhTOcl2OftWvdx7ZekxBXXg62vkidnSnbjjl00FELbUt kbw9zDImaw1eQIKJkYGbI7q1dGoT7qCGGAKQI1aXRfdl0zlZhgPkt0a33DTj1SOzFLFQF xadphGj70BoBY3dGYRSOoCOtmS+XXgfprYV4+H/4FlLVQOKQrUCk7Jei4XPmIpAFkNA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796297467; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=tCj7j44WyDZEDCq5KjtBGjy/YrmMzH6wcYXvXzZ+feg=; b=q3xFrKT/iT5a70RKhCQO1Df3Bl0AjPvy+ySRHPmt3ts1cS/+bGE7It/1u8xySgjQkwwZ l5xB+4LS5db4EmgG6zMx+QSa7keUrTGLXVSaVRHuQGoy9x1wyM51iwEAkZmn1S1sILiB+ NsWd/6cv52GB5XTciYu5QS3f9VL5QzgHV67fxPWRJcahcRdg7a+X8IQ1XXOP7DpAT9wsd 3DfWHPALAOFuSlR8K7VB/86SKXtIftiQKuT4JacVpG/EGpxuhGgxTxqe1HvpipOWKdQ+B JbBR0DU+Dbo9GOWWBRcj2Eqzzgyz2AFYHuE5Me4vPI6wyK6Tsn1RyipayBIDMLLFqeg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QdaMGEM9; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F4F6606A335 for ; Thu, 3 Dec 2026 11:31:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QdaMGEM9 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E42DC1F0089C; Thu, 3 Dec 2026 11:31:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796297467; bh=tCj7j44WyDZEDCq5KjtBGjy/YrmMzH6wcYXvXzZ+feg=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=QdaMGEM9hg9tl8BPADcI+mdWGg7PE8oGCgwsa2VB4WT6cNaAuFKP0eNUCkH7gb0E2 vujcZjTGlnIj2XEfVxpf35E5gwXejPoiq8vN1wUcdZwCCg6fXSX81I4DRiKUKKFL7R cCKfAzn8XhcXt3RVkC5OsUo3h5mFvYCjfGgpKjcruTealb0IAP/8Xay1CizNclpDPe C8rd9I/4jZ5JLdq/k4qG1LqjWEeu7ahHIesq4Vr+Zgo2GDzI/4rMKjU1J6QJdWontp gfSvdbposkBuMrzAa431rZI9+j7VebXFNDkfaQ0f2EYNRctw7zUfC/uTGd1tEeVDtD nyw0h6UajKDXw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [for-next v4 3/4] RDMA/ionic: Accept CQ ring buffers as ioctl umem attributes Reply-To: sashiko-reviews@lists.linux.dev To: "Abhijit Gangurde" Cc: linux-rdma@vger.kernel.org In-Reply-To: <20261203110805.2577721-4-abhijit.gangurde@amd.com> References: <20261203110805.2577721-1-abhijit.gangurde@amd.com> <20261203110805.2577721-4-abhijit.gangurde@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 11:31:06 +0000 X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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/in= finiband/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, u= 32 cqid) [ ... ] > - umem =3D ib_umem_get_cq_buf_or_va(&dev->ibdev, NULL, req_cq->addr, > - req_cq->size, IB_ACCESS_LOCAL_WRITE); > + umem =3D 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); > =20 > - /* The ring is given to the device as whole pages */ > - if (ib_umem_offset(umem)) { > + if (!umem) { > + umem =3D 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 !=3D 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, s= truct ib_udata *udata) > resp.udma_count =3D dev->lif_cfg.udma_count; > resp.expdb_mask =3D dev->lif_cfg.expdb_mask; > resp.rcq_sign_bit =3D dev->lif_cfg.rcq_sign_bit; > - resp.comp_mask |=3D IONIC_CTX_CMASK_IONIC_FLAGS; > + resp.comp_mask |=3D IONIC_CTX_CMASK_IONIC_FLAGS | > + IONIC_CTX_CMASK_CQ_QP_BUF_UMEM; > =20 > if (dev->lif_cfg.sq_expdb) > resp.expdb_qtypes |=3D 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 @@ > =20 > enum ionic_ctx_resp_comp_mask { > IONIC_CTX_CMASK_IONIC_FLAGS =3D 1 << 0, > + IONIC_CTX_CMASK_UDP_SPORT =3D 1 << 1, > + IONIC_CTX_CMASK_CQ_NOTIFY_IOCTL =3D 1 << 2, > + IONIC_CTX_CMASK_CQ_QP_BUF_UMEM =3D 1 << 3, > }; > =20 > 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203110805.2577= 721-1-abhijit.gangurde@amd.com?part=3D3