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=1796487012; b=Pzv+7sWJvemdSW2G9quJ4F3akaJOY+W226M4Up+quNaDv18oFEW0VYNPuvQseZizRKNq H54ZD4GmgwOMYiHgA5egjFe6szabi2Vcj/ux5mlgqlE/cu3OzG/Pw9wsRT1m21zL7xPr3 RZoaPSprI/q+EdNyItfJyY6dOD1l5DpiFYaQ4UPUFoY5RTuVsLBj7Wguo3yXoJPMn+E+E 4+DJg0GQGZPVLYUit+J+13sx9b1vHdQZESM61TRP3vFEx9vD6iL8Gcy3etsndpi6yr2Jo WUiyJbZhrSpX7E1xEnt1UuVbz1TnVI7n1LZO+fh+zgWiL1lbtFBAa0Pu907doOnxanQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796487012; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=tcdVF+jUpwOSu8xvPGWrwgfo/Moyj0q3aY5trpLq7kg=; b=30lw0DQyqo+qfUvZhzOTTsKx7fH+g+OCTOxs7VHM6Y65lZ5u6Psyl5DvtlhfQvBDeaiT RUpByuJzyRlaFtFaSAu19o3OOV8qOQDzdK3G2j3rNUesEcHF/3qe6UbuEV4P2t5SyLZza EMUNjRgUA/SXr5JlJVio2fcP/8yKmlqfRhT2lyuIUJpWtYTM2jbOGFYvYPTtZccC+ekXs c4HYVzwNItVO1sgPywvLnwMezTbLmcDMRsewfP04p9OLLQU6zzqAfdkPtzaUIkVG3A//2 LIVU7RTCY0nfaOI1bCuk5CbRHeGKkrKrDhOUcVuYFndDme6+livSJeuz0gPJ2FJjQgg== 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=G4OoO4BQ; 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 0E268606A338 for ; Sat, 5 Dec 2026 16:10:12 +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=G4OoO4BQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDD641F00A12; Sat, 5 Dec 2026 16:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796487011; bh=tcdVF+jUpwOSu8xvPGWrwgfo/Moyj0q3aY5trpLq7kg=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=G4OoO4BQ+rzCddwE1rmpCO3RT5yleogd0+EYjdF8BRABIY+hrlhx8T7HYYJLoKZuO p7JvIGxmO4fZ/v1fLywTG6Rl/lQU9qNp9xQhj054E2uf8yjvg6rtZb3WkGNkG60mvG OouPi3eGYk8lrNyu8EfND0dPAgsjwiVXB3oPi6sIFVDERLEkKBIDAw1tGLhmF8RJpm Gh4c+N6KSVW7+6c0QBQrbIUb2R+HcW3hp2KrsIdsQVE/9BqvPiLeup6HPaYuyufNYi +jT5Qt8fs2hDQ0yulGtpfTuQwP9/6h816n6DxK1KwTn7fHREE6BzoL9aLYF0xl7/Iv lK9s1O4Uq47dA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RDMA v2 10/13] RDMA/bng_re: Add Stats verbs Reply-To: sashiko-reviews@lists.linux.dev To: "Siva Reddy Kallam" Cc: linux-rdma@vger.kernel.org In-Reply-To: <20261204155249.1002019-11-siva.kallam@broadcom.com> References: <20261204155249.1002019-1-siva.kallam@broadcom.com> <20261204155249.1002019-11-siva.kallam@broadcom.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 16:10:11 +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: - [Medium] RDMA/bng_re: bng_re_ib_get_hw_stats() ignores firmware query errors - [Medium] RDMA/bng_re: bng_sp_query_srq() leaks DMA sbuf on unposted timeouts - [Low] RDMA/bng_re: commit message omits RCFW msg->posted and sbuf timeout changes - [Low] RDMA/bng_re: bng_re_alloc_hw_port_stats() exposes unsupported ext counters -- commit db6ba711153b68d8a6509d08bb7e50da99843672 Author: Usman Ansari > RDMA/bng_re: Add Stats verbs > > This patch adds below verbs. > - bng_re_alloc_hw_port_stats > - bng_re_ib_get_hw_stats > > Signed-off-by: Usman Ansari > Signed-off-by: Siva Reddy Kallam [Severity: Low] Should the commit message also describe the shared RCFW and side-buffer changes? In addition to the stats verbs, this patch adds posted tracking to struct bng_re_cmdqmsg and bng_re_rcfw_send_message(), adds oos_prev and init_oos_stats to struct bng_re_rcfw, and introduces bng_re_free_sbuf() to keep DMA side buffers allocated when a posted command times out. [ ... ] > diff --git a/drivers/infiniband/hw/bng_re/bng_hw_counters.c b/drivers/inf= iniband/hw/bng_re/bng_hw_counters.c > new file mode 100644 > index 0000000000000..be32c59cc59eb > --- /dev/null > +++ b/drivers/infiniband/hw/bng_re/bng_hw_counters.c [ ... ] > +struct rdma_hw_stats *bng_re_alloc_hw_port_stats(struct ib_device *ibdev= , u32 port_num) > +{ > + int num_counters =3D 0; > + > + num_counters =3D BNG_RE_NUM_EXT_COUNTERS; > + > + return rdma_alloc_hw_stats_struct(bng_re_stat_descs, num_counters, > + RDMA_HW_STATS_DEFAULT_LIFESPAN); > +} [Severity: Low] Does bng_re_alloc_hw_port_stats() expose unsupported extended counters on firmware without CREQ_QUERY_FUNC_RESP_SB_EXT_STATS? bng_re_ib_get_hw_stats() only queries extended stats when bng_ext_stats_supported() is true, but bng_re_alloc_hw_port_stats() unconditionally allocates BNG_RE_NUM_EXT_COUNTERS, leaving 20 extended counters permanently at 0 in sysfs and netlink when unsupported. In enum bng_re_hw_enum_stats, BNG_RE_REQ_CQE_ERROR, BNG_RE_RESP_CQE_ERROR, and BNG_RE_RESP_REMOTE_ACCESS_ERRS are also placed after the extended counters; moving them before the extended range would let bng_re_alloc_hw_port_stats() and bng_re_ib_get_hw_stats() expose only the supported prefix. [ ... ] > + err_s =3D &rdev->stats.rstat.errs; > + if (test_bit(BNG_RE_FLAG_ISSUE_ROCE_STATS, &rdev->flags)) { > + rc =3D bng_re_get_roce_stats(&rdev->rcfw, err_s); > + if (rc) > + goto done; > + bng_re_copy_err_stats(rdev, stats, err_s); > + if (bng_ext_stats_supported(rdev->chip_ctx, rdev->dev_attr->dev_cap_fl= ags)) { > + rc =3D bng_re_get_ext_stat(rdev, stats); > + if (rc) > + goto done; > + } > + } > + > +done: > + return BNG_RE_NUM_EXT_COUNTERS; > +} [Severity: Medium] Should bng_re_ib_get_hw_stats() return rc on failure instead of BNG_RE_NUM_EXT_COUNTERS? When bng_re_get_roce_stats() or bng_re_get_ext_stat() fails, jumping to done discards rc and reports all counters as updated. RDMA core (update_hw_stats() and stat_get_doit_default_counter()) requires a negative return value to detect failure; returning BNG_RE_NUM_EXT_COUNTERS advances stats->timestamp and serves stale, zeroed, or torn snapshots (such as fresh error counters paired with stale extended counters). In addition, BNG_RE_FLAG_ISSUE_ROCE_STATS is never cleared on persistent firmware -EIO rejections, which do not set FIRMWARE_STALL_DETECTED, so every subsequent stats read retries the failing command, allocates and frees a coherent DMA buffer, and logs dev_err(). [ ... ] > diff --git a/drivers/infiniband/hw/bng_re/bng_sp.c b/drivers/infiniband/h= w/bng_re/bng_sp.c > index 40fe509db724c..f2b3c0234b90b 100644 > --- a/drivers/infiniband/hw/bng_re/bng_sp.c > +++ b/drivers/infiniband/hw/bng_re/bng_sp.c > @@ -915,3 +915,162 @@ int bng_sp_destroy_srq(struct bng_re_res *res, stru= ct bng_sp_srq *srq) > =20 > return 0; > } > + > +/* > + * Free a response side buffer after a query. > + * > + * Firmware DMAs the response straight into the side buffer. If a posted > + * command times out, the driver only abandons it, firmware may still > + * write the response later. Freeing the buffer then would let firmware > + * write into memory that has been reused, so leave this small buffer > + * allocated in that case. > + * > + * A timeout reported before the command was posted, such as after a > + * firmware stall was already detected, never exposed the buffer to > + * firmware, so it is freed as usual to avoid leaking one on every call. > + */ > +static void bng_re_free_sbuf(struct bng_re_rcfw *rcfw, struct bng_re_rcf= w_sbuf *sbuf, > + struct bng_re_cmdqmsg *msg, int rc) > +{ > + if (rc =3D=3D -ETIMEDOUT && msg->posted) > + return; > + > + dma_free_coherent(&rcfw->pdev->dev, sbuf->size, sbuf->sb, sbuf->dma_add= r); > +} [Severity: Medium] Should bng_sp_query_srq() in this same file also be updated to use bng_re_free_sbuf()? bng_sp_query_srq() allocates a DMA side buffer with the same pattern, but still skips freeing it on every -ETIMEDOUT: drivers/infiniband/hw/bng_re/bng_sp.c:bng_sp_query_srq() { ... if (rc !=3D -ETIMEDOUT) dma_free_coherent(&rcfw->pdev->dev, sbuf.size, sbuf.sb, sbuf.dma_addr); } Once FIRMWARE_STALL_DETECTED is set or pci_channel_offline() is true, __send_message_basic_sanity() makes bng_re_rcfw_send_message() return -ETIMEDOUT immediately before posting, so every subsequent query_srq call (such as via IB_USER_VERBS_CMD_QUERY_SRQ) leaks a coherent DMA buffer. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204155249.1002= 019-1-siva.kallam@broadcom.com?part=3D10