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=1796398916; b=h6Gtfxb+8z6WE0U3gjm8HKdyj9j/P/BmdKaMakvvRO+L88cgByQt5XdtdnY04bgU0FBS PAi2R+S19zuLN7tN86UTf+dk2AvUbG1QL6Ck0NNCl62lYskmUR1O0KleqYv0C1EZjrUsh fpq6pVcBV57lkuSQvEtFA4Bnh31iqiyq/qRHrIkvYoifYn4n3+8B31rphMRYnvnlDjLZL ubzBNkgrbhnHM3ZYSKy9VxSBW/xdOBOBQrEzVQH6CKlD+d4iNB3ygwsbFxMe7L25Q6EkU m+hoaQtNB4AhsMWPl3zZbuQ+uff80N9lS4mbMf+Ji6n6Ucda9d6qkbyCPnblNTOF9qQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796398916; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=aetvwxBEKI4V6vIlorY5y2hUJO2VRNYnmhW7YwlVBJg=; b=unhjsi/5j0g+5vi/BeiPg7YBEdiB1Zx0WlVekq37mQX0p6Awa0nCvACXfaW9QN5d2kUx xuB2fc/2g/pSUyJ83IObOFi79anNnhFA7vyqsSxJ+1eBs/FLi3Lhs+QUuesYkc9Q7mm+0 TWpqtDeyGW/fBAbqBvEjaB+/7RKz62cBELLvFUG+hawHCamP0f7QIFKuEXkArhh9E4oVL r2jrODHG/er6baF3Cwi6ZjHDd4iJWcthahIdmh8Z5kPhcuMVdBFfa+oOIe6HMh/tb7Mug jahah0l+fOf2tFpNiY8cbLawYXGw9eNXx7WA0yLuyGiwKl+oRbNqovE16qexYu4j0pQ== 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=RkHy4L11; 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 0D3E5606A32F; Fri, 4 Dec 2026 15:41:55 +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=RkHy4L11 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0C4C1F000C2; Fri, 4 Dec 2026 15:41:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796398915; bh=aetvwxBEKI4V6vIlorY5y2hUJO2VRNYnmhW7YwlVBJg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=RkHy4L11mSUpMi6i9YmlH8UxPQrFb2MtPVlwlNwSWzjxvZ+Endz6cDPuragBhKlZF F12Rn7i6wCr5QIJBpOaKpoxFLpR99PYYkekngVQrnRfLvQHrD1jeeXdfVTG4IeJim3 r8gfCU/rhzk+pZqLJIBfYKZuUWXWZfeN+2vEOtPs+Q0jNCDTybjsU+Bp8RTs6vHs5y Dj0Te4NAfY69kwrDOCDzHcjSSZedq7WQZZtmS3T2s0g8Ob0ndheb13HRd8yGiJAVJk 5Mm35elh5idUiumJXAONlMzl/hL8UqW3JLVbgyLZ4t4H5iHO7yjPQXR+1grmhONoNz 3oTS8vTLa52uA== Subject: Re: [PATCH net-next v2 3/4] net/smc: set a new link's peer gid and mac at creation From: netdev-bot+sashiko@kernel.org To: ermenson.sec@gmail.com Cc: alibuda@linux.alibaba.com, dust.li@linux.alibaba.com, sidraya@linux.ibm.com, mjambigi@linux.ibm.com, tonylu@linux.alibaba.com, guwen@linux.alibaba.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org Date: Fri, 04 Dec 2026 15:41:54 +0000 Message-ID: <179639891424.3146.6361540241954783090@kernel.org> In-Reply-To: <20261203153514.1440337-4-ermenson.sec@gmail.com> References: <20261203153514.1440337-4-ermenson.sec@gmail.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The commit message never says why the change is needed, and it hides a hard dependency. - [Low] "No reader changes behaviour" is not accurate for user-visible output. - [Low] Both the commit message and the new comment in smcr_link_init() say the add-link callers overwrite peer_gid/peer_mac in… - [Low] The new comment in smcr_link_init() says "peer_qpn, peer_psn and peer_mtu come from the peer's CLC CONFIRM". -- net/smc: set a new link's peer gid and mac at creation This patch makes smcr_link_init() copy peer_gid and peer_mac from smc_init_info into the new link when the link is created. Before, both stayed zero until smc_link_save_peer_info() ran after the CLC accept or confirm. The add-link paths pass a zeroed smc_init_info and fill both fields from the ADD_LINK message. > smcr_link_init() leaves lnk->peer_gid and lnk->peer_mac zero. They are > filled only once the peer's CLC accept or confirm has been processed, by > smc_link_save_peer_info(), which copies them out of smc_init_info. Both > values are already in smc_init_info when the link is created, so set them > there. This changes when the fields become valid, not what they hold. [Severity: Low] The message explains why the change is harmless. Could it also say why the change is needed? As far as I can tell, the reason is the next patch in the series, "net/smc: drop smc_server_lgr_pending across the CLC CONFIRM wait". That patch adds smcr_lgr_pending_match(), which reads peer_gid and peer_mac of links still in SMC_LNK_ACTIVATING: if (!memcmp(lnk->peer_gid, ini->peer_gid, SMC_GID_SIZE) && (ini->smcr_version == SMC_V2 || !memcmp(lnk->peer_mac, ini->peer_mac, ETH_ALEN))) These fields are only non-zero at that point because of this patch. Neither commit message mentions the dependency. smc_link_save_peer_info() in af_smc.c still does the same copy: memcpy(link->peer_gid, ini->peer_gid, SMC_GID_SIZE); memcpy(link->peer_mac, ini->peer_mac, sizeof(link->peer_mac)); So the patch writes the same values a second time rather than moving the first write. Read on its own, the patch looks like a no-op cleanup that could be dropped. If it were dropped, the next patch would still build, but smcr_lgr_pending_match() would compare zeros against ini->peer_gid and never match. Would it make sense to state this dependency in the commit message? > No reader changes behaviour: the QP is programmed from the gid only after > the peer info is saved, smcr_lgr_match() looks at active links, and the > netlink and diag paths display the field. [Severity: Low] Is "No reader changes behaviour" accurate for what user space sees? smc_nl_handle_lgr() dumps every link that passes smc_link_usable(). smc_link_usable() rejects only SMC_LNK_UNUSED and SMC_LNK_INACTIVE, so SMC_LNK_ACTIVATING links are dumped too: net/smc/smc_core.c:smc_nl_handle_lgr() { ... if (!smc_link_usable(&lgr->lnk[i])) continue; if (smc_nl_fill_lgr_link(lgr, &lgr->lnk[i], skb, cb)) ... } smc_nl_fill_lgr_link() puts link->peer_gid into SMC_NLA_LINK_PEER_GID. __smc_diag_dump() in smc_diag.c exports it as well. On the server, smc_lgr_create() adds the link group to smc_lgr_list right after smcr_link_init(). The link then stays ACTIVATING for the whole CLC CONFIRM wait, which can last up to CLC_WAIT_TIME. Netlink and diag dumps taken during that window used to show an all-zero peer GID. They now show the GID from the proposal. This includes handshakes that later time out and get cleared. The value is the same one smc_link_save_peer_info() stores later, so this looks harmless. Could the message describe this change rather than call it a non-change? The message also leaves out two other readers: the link selection loop in smc_connect_rdma() and smc_llc_find_asym_link(). Neither seems to change in practice: - The smc_connect_rdma() loop also needs peer_qpn to match, and peer_qpn is still 0. - smc_llc_find_asym_link() never sees two links during a first contact. > diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c > index 34fd8f3e7939f..61d4d4b559caf 100644 > --- a/net/smc/smc_core.c > +++ b/net/smc/smc_core.c > @@ -824,6 +824,15 @@ int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk, > lnk->wr_rx_sge_cnt = 1; > lnk->wr_rx_buflen = SMC_WR_BUF_SIZE; > } > + /* peer_qpn, peer_psn and peer_mtu come from the peer's CLC CONFIRM and > + * are filled later by smc_link_save_peer_info(). The gid and the mac are [Severity: Low] Does this hold on the client side? Only the server takes these values from the CLC CONFIRM, in smc_listen_rdma_finish(): smc_link_save_peer_info(link, cclc, ini); On the client, smc_connect_rdma() passes the server's CLC ACCEPT: if (ini->first_contact_local) smc_link_save_peer_info(link, aclc, ini); So for client first links, peer_qpn, peer_psn and peer_mtu come from the ACCEPT. The commit message gets this right ("the peer's CLC accept or confirm"). At the end of the series, the comment still names only CLC CONFIRM for these fields. The same comment says the gid and mac come "from the proposal on the server and from the accept on the client", so the comment contradicts itself. > + * already in ini here, and smc_link_save_peer_info() copies them from the > + * same fields, so this changes when they become valid and not what they > + * hold. The add-link callers pass a zeroed ini and overwrite both in > + * smc_llc_save_add_link_info() straight after. > + */ [Severity: Low] Is "straight after" accurate for the server add-link path? It holds for the client, where smc_llc_cli_add_link() calls smc_llc_save_add_link_info() right after smcr_link_init(). In smc_llc_srv_add_link(), several steps run between the two calls, including a blocking wait for the peer: smc_llc_srv_add_link() smcr_link_init() smcr_buf_map_lgr() smc_llc_send_add_link() smc_llc_wait(..., SMC_LLC_WAIT_TIME, SMC_LLC_ADD_LINK) ... smc_llc_save_add_link_info(link_new, add_llc); The -ETIMEDOUT and -ENOLINK exits after smc_llc_wait() skip smc_llc_save_add_link_info() entirely. Later in the series, "net/smc: drop smc_server_lgr_pending across the CLC CONFIRM wait" changes the comment to say "afterwards". This commit message still says "straight after". Could the comment be fixed in this patch rather than in a later one, and the commit message updated to match? The comment also reads like a changelog ("this changes when they become valid and not what they hold"), and it still does at the end of the series. It describes the patch rather than the code, which will read oddly once merged. Could it describe the code's behaviour instead? [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203153514.1440337-1-ermenson.sec%40gmail.com