From: Bryam Vargas <hexlabsecurity@proton.me>
To: netdev-bot+sashiko@kernel.org,
"D . Wythe" <alibuda@linux.alibaba.com>,
Dust Li <dust.li@linux.alibaba.com>,
Sidraya Jayagond <sidraya@linux.ibm.com>,
Mahanta Jambigi <mjambigi@linux.ibm.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@kernel.org>,
"David S . Miller" <davem@davemloft.net>
Cc: Simon Horman <horms@kernel.org>,
Tony Lu <tonylu@linux.alibaba.com>,
Wen Gu <guwen@linux.alibaba.com>,
Wenjia Zhang <wenjia@linux.ibm.com>,
Hidayath Khan <hidayath@linux.ibm.com>,
Ursula Braun <ubraun@linux.ibm.com>,
Stefan Raspl <raspl@linux.ibm.com>,
linux-s390@vger.kernel.org, linux-rdma@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net/smc: don't spin in smc_rx_recvmsg() while a pipe holds spliced data
Date: Thu, 29 Oct 2026 08:04:08 +0000 [thread overview]
Message-ID: <20261029080359.961295-1-hexlabsecurity@proton.me> (raw)
In-Reply-To: <179209723095.434549.11206499945190748009@kernel.org>
On Thu, 15 Oct 2026 20:47:10 +0000, netdev-bot+sashiko@kernel.org wrote:
> [Severity: Medium]
> Can this wait miss the final wakeup on weakly ordered architectures?
Yes. Between the entry's store in add_wait_queue() and the read of
splice_pending the sleeper only has an unlock and a lock acquire, not
a full barrier; the release side reads the list after its own
smp_mb(), so the gap is the sleeper's. v2 puts an smp_mb() after
add_wait_queue(). Checked with herd7 against LKMM: the lost wake is
allowed without it, forbidden with it. smc_rx_wait() has the same
gap, but every CDC message that brings data wakes it again; this wait
has only the pipe release to wake it, so the barrier matters here.
Moving the decrement under lock_sock() is the change Hidayath Khan
announced in [1]; the barrier closes the window on its own and
doesn't depend on it.
> [Severity: Low]
> Should smc_rx_wait_splice() do the same?
Yes, v2 sets and clears SOCKWQ_ASYNC_WAITDATA around the sleep.
Measured on the v1 setup with one more case, an O_ASYNC reader owned
by the reading thread, blocked behind the pipe while the peer sends
one more byte: v1 returns -EINTR within 1 ms of the byte, v2 sleeps
on and reads the next 4096 bytes once the pipe is drained, as the
unpatched kernel does.
> [Severity: Medium]
> This is a pre-existing issue that this patch didn't introduce: can the
> splice path read a stale splbytes here?
It can; the fix is Hidayath's change in [1]. This patch doesn't touch
that path.
> [Severity: Medium]
> This is a pre-existing issue rather than one added by this patch, but
> smc_poll() still disagrees with this -EAGAIN:
The commit message of v2 now says so: a non-blocking read behind the
pipe returns -EAGAIN while poll() reports the socket readable, since
bytes_to_rcv counts the data behind the pipe. A level-triggered loop
that keeps the spliced bytes in a pipe gets EPOLLIN and -EAGAIN until
it drains that pipe; before the patch the same read didn't return
until the drain, asleep, one pass per tick, not spinning (measured).
Looking at splice_pending in smc_poll() would hide data splice() can
still take (a second splice with the first undrained returns the next
4096 bytes at once, measured), so v2 leaves poll() alone; the pipe
release wakes the socket.
[1] https://lore.kernel.org/all/7a174d1f-80d8-4294-ae66-829c9dacd662@linux.ibm.com/
pw-bot: cr
prev parent reply other threads:[~2026-10-29 8:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 20:45 Bryam Vargas via B4 Relay
2026-10-13 20:50 ` netdev-bot+sinfo
2026-10-15 20:47 ` netdev-bot+sashiko
2026-10-29 8:04 ` Bryam Vargas [this message]
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=20261029080359.961295-1-hexlabsecurity@proton.me \
--to=hexlabsecurity@proton.me \
--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=hidayath@linux.ibm.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjambigi@linux.ibm.com \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=raspl@linux.ibm.com \
--cc=sidraya@linux.ibm.com \
--cc=tonylu@linux.alibaba.com \
--cc=ubraun@linux.ibm.com \
--cc=wenjia@linux.ibm.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
all inboxes | Powered by JetHome®