Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Ermenson Junior <ermenson.sec@gmail.com>
To: mjambigi@linux.ibm.com, alibuda@linux.alibaba.com,
	dust.li@linux.alibaba.com, sidraya@linux.ibm.com
Cc: 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] net/smc: serialize the server establishment phase per peer, not globally
Date: Thu,  3 Dec 2026 12:46:23 -0300	[thread overview]
Message-ID: <20261203154623.1442206-1-ermenson.sec@gmail.com> (raw)
In-Reply-To: <d2e182df-d48a-4835-83e7-080d211d634e@linux.ibm.com>

Hi Mahanta,

A duplicate link group is harmless for correctness and not free in
resources, so I took your preferred route. v2 drops the hash.

Correctness: the ACCEPT carries ini->first_contact_local, and the client
side of smc_conn_create() then takes its "create new link group as well"
path, so both ends stay symmetric and no decline is sent. The
SMC_CLC_DECL_SYNCERR case below it is the mirror, server reuses and client
wanted new. Several groups per peer is already reachable too, since for
SMC_SERV the reuse condition refuses a group at max_conns or with a full
rtoken bitmap. And smcr_lgr_match() already compares the link's peer_gid,
so a peer varying its GID gets a fresh group with or without my patch.

Resources: lgr_cnt is a counter and not a cap, and an idle server side
group is held SMC_LGR_FREE_DELAY_SERV, 600 seconds, before
smc_lgr_free_work reclaims it. A multi-port peer falling back to v1 pays
double for ten minutes of idleness. Small, not nothing, and a behaviour
change nobody asked for.

The Sashiko bot's finding on this thread is also correct, and v2 removes the
function it was about. For the archive: smcr_indicated() is true for
SMC_TYPE_R, which is 0, so it is true for the reserved zero typev2 of a v1
proposal, and smc_get_clc_msg_smcd() then returns prop + 1 unchecked
because its guard only fires for smcd_indicated(typev1). The key mixed in
IP prefix bytes. It is a wrong-field read and not out of bounds, since
max_offset is computed inside struct smc_clc_msg_proposal_area.

v2 makes a link group that is still establishing findable, so a second
connection of the same peer defers to it, and the mutex no longer spans the
CONFIRM wait. It still covers smc_lgr_create(), which is needed: until the
list_add_tail() there the group is not on smc_lgr_list. Deferrals are
bounded by a window of two CLC_WAIT_TIME, which is wider than the longest a
link stays in SMC_LNK_ACTIVATING, so the create-anyway fallback is not
reachable at today's constants. One second of margin.

One thing v2 does not fix, since I claimed otherwise in v1: after the retry
joins, smcr_lgr_reg_rmbs() runs under the mutex and starts with
smc_llc_flow_initiate(), which sleeps while the first peer's ADD_LINK flow
is active. Unchanged by this series.

It grew to four patches. Taking the whole of smc_listen_rdma_finish() out
from under the mutex lets a joining connection of this peer block on
rmbs_lock or llc_conf_mutex with no timeout while holding it, waiting on
the first contact's add-link flow. The Sashiko bot raised that loop on v1
as pre-existing and it is unbounded, so patches 1 and 2 bound it and come
first. Patch 3 fills the peer gid and mac at creation, which patch 4 needs.

Unrelated peer's connect during a silent peer's handshake went 4397.8 ms to
1.5 ms. Your v1 control does not work here and the series notes say why.

v2: <20261203153514.1440337-1-ermenson.sec@gmail.com>

Thanks for the review.

Ermenson

  reply	other threads:[~2026-12-03 15:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 13:12 [PATCH net-next] net/smc: serialize the server establishment phase per peer, not globally Ermenson Junior
2026-12-03  8:35 ` Mahanta Jambigi
2026-12-03 15:46   ` Ermenson Junior [this message]
2026-12-03 13:13 ` sashiko-bot
2026-12-03 13:31 ` 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=20261203154623.1442206-1-ermenson.sec@gmail.com \
    --to=ermenson.sec@gmail.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=dust.li@linux.alibaba.com \
    --cc=edumazet@kernel.org \
    --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