Article View: linux.kernel.netdev
Article #27004Re: [PATCH net-next v2 1/4] net/smc: bound the SMC-Rv1 add-link rkey exchange
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 15:41
Date: Fri, 04 Dec 2026 15:41
151 lines
13548 bytes
13548 bytes
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 says "Neither check rejects a message a
conforming peer can send." That holds for the round cap but not forβ¦
- [Low] The new overall deadline (SMC_LLC_RKEY_EXCHG_TIME) is only
checked at the top of each round.
--
net/smc: bound the SMC-Rv1 add-link rkey exchange
This commit limits the SMC-Rv1 ADD_LINK_CONT rkey exchange loops in
smc_llc_cli_rkey_exchange() and smc_llc_srv_rkey_exchange() to
SMC_LLC_RKEY_CONT_MSG_MAX (128) rounds. It also adds an overall deadline,
SMC_LLC_RKEY_EXCHG_TIME. A peer that keeps reporting num_rkeys=255 can no
longer keep the loop running forever.
> Cap the rounds at that derived limit and give
> the exchange as a whole a deadline: the round cap on its own would
> still allow 128 * SMC_LLC_WAIT_TIME of held mutex, and a deadline on
> its own would still allow an unbounded number of instant rounds under
> it. Neither check rejects a message a conforming peer can send.
[Severity: Low]
Is the last sentence accurate for the deadline? The round cap comes from
the protocol. SMC_LLC_RKEY_EXCHG_TIME is a fixed (SMC_LLC_WAIT_TIME * 10),
which is 20 seconds no matter how many rkeys need to be exchanged.
Before this patch, a peer only had to answer each ADD_LINK_CONT within
SMC_LLC_WAIT_TIME. A full 128 round exchange could therefore legitimately
take up to about 256 seconds.
Both smc_llc_cli_rkey_exchange() and smc_llc_srv_rkey_exchange() now run
this check at the top of each round:
timeo = (long)(expire - jiffies);
if (timeo <= 0) {
rc = -ETIMEDOUT;
...
}
A peer can answer every message within 2 seconds and still be aborted, if
its replies average more than about 156 ms per round over 128 rounds.
Slow rounds can have several causes:
- the peer blocks in smc_wr_tx_get_free_slot(), for up to
SMC_WR_TX_WAIT_FREE_SLOT_TIME
- workqueue latency
- a non-Linux SMC-Rv1 implementation
Nothing is logged when this happens. smc_llc_cli_add_link() sets rc = 0
and goes to out_clear_lnk. smc_llc_srv_add_link() goes to out_err. In both
cases the link group quietly runs without its second link.
Could the commit message say that the deadline can reject a slow but
conforming peer? Or could the deadline be derived from the number of
rounds instead?
> diff --git a/net/smc/smc_llc.c b/net/smc/smc_llc.c
> index c9ccd8480369c..818dd84e720fc 100644
> --- a/net/smc/smc_llc.c
> +++ b/net/smc/smc_llc.c
[ ... ]
> @@ -1359,11 +1384,25 @@ static int smc_llc_srv_rkey_exchange(struct smc_link *link,
> down_write(&lgr->rmbs_lock);
> num_rkeys_send = lgr->conns_num;
> buf_pos = smc_llc_get_first_rmb(lgr, &buf_lst);
> + expire = jiffies + SMC_LLC_RKEY_EXCHG_TIME;
> do {
> + long timeo;
> +
> + if (rounds++ >= SMC_LLC_RKEY_CONT_MSG_MAX) {
> + rc = -EPROTO;
> + goto out;
> + }
> + timeo = (long)(expire - jiffies);
> + if (timeo <= 0) {
> + rc = -ETIMEDOUT;
> + goto out;
> + }
> + if (timeo > SMC_LLC_WAIT_TIME)
> + timeo = SMC_LLC_WAIT_TIME;
> +
> smc_llc_add_link_cont(link, link_new, &num_rkeys_send,
> &buf_lst, &buf_pos);
> - qentry = smc_llc_wait(lgr, link, SMC_LLC_WAIT_TIME,
> - SMC_LLC_ADD_LINK_CONT);
> + qentry = smc_llc_wait(lgr, link, timeo, SMC_LLC_ADD_LINK_CONT);
[Severity: Low]
Can the exchange run past SMC_LLC_RKEY_EXCHG_TIME here? timeo is
computed and capped before smc_llc_add_link_cont(), then passed unchanged
to smc_llc_wait().
smc_llc_add_link_cont() can sleep:
smc_llc_add_link_cont()
smc_llc_add_pending_send()
smc_wr_tx_get_free_slot()
wait_event_interruptible_timeout(link->wr_tx_wait, ...,
SMC_WR_TX_WAIT_FREE_SLOT_TIME);
SMC_WR_TX_WAIT_FREE_SLOT_TIME is 10 * HZ. This wait can happen when all TX
slots are busy, for example when the peer delays completions.
Say a round starts with R jiffies left. It can block for up to 10 seconds
in the send, then still wait up to min(R, SMC_LLC_WAIT_TIME) for the
reply. The exchange can therefore end about 10 seconds past the deadline.
That is also how much longer rmbs_lock, llc_conf_mutex and
smc_server_lgr_pending can stay held.
The later patch in this series, "net/smc: check the ADD_LINK_CONT send
result in the server rkey exchange", only adds a return value check after
the send. It does not recompute timeo, so the overrun is still there at
the end of the series.
The client loop has a similar but smaller overrun. In
smc_llc_cli_rkey_exchange(), the send is the last step of a round, after
the deadline-checked wait:
smc_llc_flow_qentry_del(&lgr->llc_flow_lcl);
rc = smc_llc_add_link_cont(link, link_new, &num_rkeys_send,
&buf_lst, &buf_pos);
if (rc)
break;
} while (num_rkeys_send || num_rkeys_recv);
A send that blocks after the last wait can also run up to 10 seconds past
the deadline.
Would it work to compute timeo after smc_llc_add_link_cont() returns,
just before smc_llc_wait(), and abort if it is <= 0? Otherwise, the
comment on SMC_LLC_RKEY_EXCHG_TIME and the commit message could call the
deadline approximate.
> if (!qentry) {
> rc = -ETIMEDOUT;
> goto out;
[ ... ]
--
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203153514.1440337-1-ermenson.sec%40gmail.com
Technical Details
Message-ID:
<179639891135.3146.7633707286604525482@kernel.org>Path:
mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377449-linux-kernel-netdev=dewy.ruReferences:
<20261203153514.1440337-2-ermenson.sec@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377449-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 1/4] net/smc: bound the SMC-Rv1 add-link rkey exchange Date: Fri, 04 Dec 2026 15:41:51 +0000 Organization: Usenet Network Message-ID: <179639891135.3146.7633707286604525482@kernel.org> References: <20261203153514.1440337-2-ermenson.sec@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2796784"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:f/v/wEg9oec3VT6jI6knrIkcbcI= sha256:6TL3IqNjM0XZTjibVk+9cf9m282zQaiDRMLSKUFtXXc= sha1:K3nav/4YrZaiVkFgNk6bI4E7B28= sha256:mQCpiUsQZ4g6PV8r9rgtI9dHzEuG6s+at/AElsoTOvI= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id B732E117C53; Fri, 4 Dec 2026 18:42:13 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.641 X-Spam-Status: No, score=-3.641 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LMJY75OaZSAf; Fri, 4 Dec 2026 18:42:10 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377449-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 33435117C17; Fri, 4 Dec 2026 18:41:56 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 70F55292A0; Fri, 4 Dec 2026 15:41:54 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796398914; b=ZonMIynMQWO94eB7jiYFDfB/fc2sIyRv00ka0tqLbPU23tOvBWvxU6owz1Hi/3qxpK3J rgpF4UBw2WEDH7kBlpIDSfzbq7wbeDMd7A9zc3LkQb//HoaPoXialjkvppHRNiLXIhl9P Z2QN+LWct6RvcozlpAtzfaO9XRC6z70nvjWJ+YgnsuBoogU4/qOwCJwjqo+DUlUmnND6T BTCW6avTWX+/Xggla7DQeUp68JI1++jw9jXJ9k0VshtybzON8IkgBU0Cklugn6uZiEUDx gIzo8jHaBr2ZoacJABAqOpTFE9MzpuOXUFygU6swKxq6Z9ib0FOuZsK9JpCkFUeksCw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796398914; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=5ZfYAzI/8NNtNhSmrbh/BTQX1w/4JxeAkhM6+SAyisk=; b=zQBotNzg2XK3nPBQxtavYgJ438iKDu+7uEWNga4z3LwUrmrro2+Kwpc1JDY3XDuPq2Ww 9eah26031ksAycNZhRRNyhETe6OWAZGJeeFuj5cloQub1/1T0GJfJC+R8JAiwpNqaH6Uu /E6OAwBo/3jq2UUy8sL7TwIVMPi6qZc0TlI9L1UiR+ye8K9e/KrAJpOHHJ1a94kw8sgME AgxdQ3uQrn8h7gCouwpu1usIp0OeaHoT+BIPKTIU4Anrju8hCZkS8zpnbgvctZep6Dt52 OjxRGKJyQFud+CSDP2A47HyIZwdu4XD3D6ZX43/y3+DYQC+PAzGWfY26AU0HUJO5obA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=PKjrz6Vj; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3B2E606A339; Fri, 4 Dec 2026 15:41:53 +0000 (UTC) X-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=PKjrz6Vj X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796398913; b=UXJJMIawrEIlqEsRX8L9Sgh5shUHUjlVHL2vspM95B4z6BI9lYAUeS9TPLfXmWc0ST9j KotT2Rf8jODHrSQNqeHodQ3F28OIYy1+3mqvhHdjCJDjHhWizv3aB05KtiiJj8cXQheIg otDrdeKnkNuJ3vfXO276AHEDeIf6GiEuzSzH+C10YfF5mo0msvUWm4InaH+FYTx8b8M/K JCanDLvKp3NStljVgGHH1MlrvRqW0yNymfvykg+3llz2yRlLCXz37rSlr3LLZVliYB2JC Pj3u/uCexhieqx1wkAdvWCQdYMgGjynyXaJkIoGHPqGuzKaAFio5ytPnqhRSPLTO9CA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796398913; 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=5ZfYAzI/8NNtNhSmrbh/BTQX1w/4JxeAkhM6+SAyisk=; b=qypeo7xzC6vD7jpc8+lha05h3bucXvUmORYN4vIzd8C9uemOBpCjDGAAvTak9Rrj3wPI tTBWIDRuMS+LVXWaziLZuA+ENdU2Loo/4BvcgPO38/aoUO9Hhe4b9A3LmuFfJCmMwM4a9 iGwOj57/lqO+Tu8YZe0qiJZ5Ccbr5jwkb+J4G3edfLuAGy9udOi37fG2Urd1K+y7KYM0/ HW94XJ2FPEds2HbGSK5ob5DzjPfyqoY7ip0s5EverWcmCSjXW7CPg5AtovW0HVxHoidW9 2LJz+Ms4j6sz00qEaPJohzeslJHUbrGjdLnp7PKOmO0zwpLDQeJ/1KxCbvRC9S3VG0g== X-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=PKjrz6Vj; arc=none smtp.remote-ip=100.103.45.18 X-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 0E9D7606A322; Fri, 4 Dec 2026 15:41:52 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C47161F000C2; Fri, 4 Dec 2026 15:41:51 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796398912; bh=5ZfYAzI/8NNtNhSmrbh/BTQX1w/4JxeAkhM6+SAyisk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=PKjrz6Vj9q7drhhaSqtFitTBYR5lBqWjSQfKpXNINwPKYV2BJXm70NmRvQDDTyRSt 1OrxNqdmQFMJ2mj9S7nMTpnSyytLzSgJqBsmaZAO5lNGG4PjBM5YtzuTYxl4qerpae jiYhzyf9r40dhuELUkgi69qvJJ1NwzggMfr9GZqTqAzIwQdfgI4oMBh+eLMbgQDJFO I3YmUjRDAzRKzW0GK/SXj7m0LU2gMyPL+M5dYSSHu2hu3Dj+mvkvfSZrGSk33P3lEZ 8K7FPd1bxcjOndVft3wQbeGBrza1mL0WdQ6hXzqB0VbtB/l/Wv1PGUDvAISWg03Y+0 cbLmtu0Y/y4NQ== X-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 X-In-Reply-To: <20261203153514.1440337-2-ermenson.sec@gmail.com> X-sashiko-severity: Low X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list