Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
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
Subject: Re: [PATCH net-next v2 2/4] net/smc: check the ADD_LINK_CONT send result in the server rkey exchange
Date: Fri, 04 Dec 2026 15:41:52 +0000	[thread overview]
Message-ID: <179639891276.3146.3933202468528297356@kernel.org> (raw)
In-Reply-To: <20261203153514.1440337-3-ermenson.sec@gmail.com>

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 for "net/smc: check the ADD_LINK_CONT send
  result in the server rkey exchange" overstates the bug.

--

net/smc: check the ADD_LINK_CONT send result in the server rkey exchange

This patch makes smc_llc_srv_rkey_exchange() check the return value of
smc_llc_add_link_cont() and leave the loop when the send fails, which
matches smc_llc_cli_rkey_exchange(). Before the patch, the server side
ignored the send result and called smc_llc_wait() anyway.

> smc_llc_srv_rkey_exchange() discards it and goes on to wait for a reply
> to a message that was never transmitted, so the round can only end in
> the wait timing out. Make the server side behave like the client side.

[Severity: Low]
Is "can only end in the wait timing out" accurate for most send failures?

smc_llc_wait() is called with a non-NULL link. wait_event_timeout()
checks its wake condition before it sleeps:

net/smc/smc_llc.c:smc_llc_wait() {
	wait_event_timeout(lgr->llc_msg_waiter,
			   (flow->qentry ||
			    (lnk && !smc_link_usable(lnk)) ||
			    list_empty(&lgr->list)),
			   time_out);
	...
}

If smc_wr_tx_link_hold() fails, smc_llc_add_link_cont() returns -ENOLINK.
In that case the link is not sendable (INACTIVE or UNUSED), so
smc_link_usable() is already false and the wait returns immediately.

There are two other failure paths: ib_post_send() failing in
smc_wr_tx_send(), and the free slot wait in smc_wr_tx_get_free_slot()
timing out with -EPIPE. Both call smcr_link_down_cond_sched()
synchronously:

net/smc/smc_core.c:smcr_link_down_cond_sched() {
	if (smc_link_downing(&lnk->state)) {
	...
}

smc_link_downing() does cmpxchg(state, SMC_LNK_ACTIVE, SMC_LNK_INACTIVE).
The link is therefore already INACTIVE when smc_llc_wait() is entered,
so the wait again returns without sleeping.

A full SMC_LLC_WAIT_TIME wait seems to happen only in narrower cases:

- the link is still ACTIVE but its QP is not in RTS (-ENOLINK or
  -EPIPE)
- the lgr is terminating but still on the list (-EBUSY)

The only caller, smc_llc_srv_add_link(), handles every non-zero rc the
same way:

	rc = smc_llc_srv_rkey_exchange(link, link_new);
	if (rc)
		goto out_err;

So the patch seems to have two visible effects. The errno changes from
-ETIMEDOUT to the send error, and the narrow cases above fail sooner.

No exchange that used to succeed now fails, and none that used to fail
now succeeds. The code change looks correct and matches
smc_llc_cli_rkey_exchange().

Since the patch carries a Fixes: tag, could the commit message say that
the effect is limited to the errno and the shorter failure time in those
cases?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203153514.1440337-1-ermenson.sec%40gmail.com

  reply	other threads:[~2026-12-04 15:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 15:35 [PATCH net-next v2 0/4] net/smc: stop a silent peer stalling every server handshake Ermenson Junior
2026-12-03 15:35 ` [PATCH net-next v2 1/4] net/smc: bound the SMC-Rv1 add-link rkey exchange Ermenson Junior
2026-12-04 15:41   ` netdev-bot+sashiko
2026-12-03 15:35 ` [PATCH net-next v2 2/4] net/smc: check the ADD_LINK_CONT send result in the server " Ermenson Junior
2026-12-04 15:41   ` netdev-bot+sashiko [this message]
2026-12-03 15:35 ` [PATCH net-next v2 3/4] net/smc: set a new link's peer gid and mac at creation Ermenson Junior
2026-12-04 15:41   ` netdev-bot+sashiko
2026-12-03 15:35 ` [PATCH net-next v2 4/4] net/smc: drop smc_server_lgr_pending across the CLC CONFIRM wait Ermenson Junior
2026-12-04 15:41   ` netdev-bot+sashiko

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=179639891276.3146.3933202468528297356@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=alibuda@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=dust.li@linux.alibaba.com \
    --cc=edumazet@kernel.org \
    --cc=ermenson.sec@gmail.com \
    --cc=guwen@linux.alibaba.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjambigi@linux.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sidraya@linux.ibm.com \
    --cc=tonylu@linux.alibaba.com \
    --cc=willemb@google.com \
    /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