All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dust Li <dust.li@linux.alibaba.com>
To: Paolo Abeni <pabeni@redhat.com>,
	Bryam Vargas <hexlabsecurity@proton.me>,
	"D. Wythe" <alibuda@linux.alibaba.com>,
	Mahanta Jambigi <mjambigi@linux.ibm.com>,
	Sidraya Jayagond <sidraya@linux.ibm.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Eric Dumazet <edumazet@kernel.org>
Cc: linux-s390@vger.kernel.org, Wen Gu <guwen@linux.alibaba.com>,
	linux-rdma@vger.kernel.org, Tony Lu <tonylu@linux.alibaba.com>,
	Wenjia Zhang <wenjia@linux.ibm.com>,
	netdev@vger.kernel.org, Stefan Raspl <raspl@linux.ibm.com>,
	Hidayath Khan <hidayath@linux.ibm.com>,
	Simon Horman <horms@kernel.org>,
	Ursula Braun <ubraun@linux.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] net/smc: don't spin in smc_rx_recvmsg() while a pipe holds spliced data
Date: Thu, 5 Nov 2026 00:56:40 +0800	[thread overview]
Message-ID: <autjyLEDJ_quR4Nm@linux.alibaba.com> (raw)
In-Reply-To: <4d97a782-8d88-4dd0-b819-fb704582f2ec@redhat.com>

On 2026-11-03 15:18:36, Paolo Abeni wrote:
>On 10/29/26 09:03, Bryam Vargas wrote:
>> While bytes spliced off the RMB are still in a pipe, recvmsg() waits
>> for the pipe to release them before it copies the data behind them.
>> The path to that wait skips the timeout and signal checks, and
>> smc_rx_wait() returns at once on RCV_SHUTDOWN. With a signal pending,
>> after SHUT_RD, or once the peer closes or shuts down writing,
>> recvmsg() spins on a CPU until the pipe is drained, and SIGKILL cannot
>> stop it. MSG_DONTWAIT and an expired SO_RCVTIMEO wait there too
>> instead of returning -EAGAIN.
>> 
>> Check the timeout and signals before that wait, and end it when the
>> pipe releases the data or the connection is killed, not on RCV_SHUTDOWN.
>> A zero-length read returns 0 without waiting for the pipe; a
>> non-blocking one returns -EAGAIN while poll() still reports the socket
>> readable (splice() can still take those bytes).
>
>@SMC experts, please review. IMHO the above trade-off sounds like a better
>solution is needed.

Hi Bryam, Paolo,

Yes, I agree this is a trade-off. But I think this was not introduced by
this patch; rather, it is a pre-existing bug. And sadly, I don't have a
good solution to solve it yet.

So for now, I prefer to accept this as a stable fix.

As for the long-term fix: the follow-up I have in mind is to remove the
zero-copy mode for splice in SMC, which will simplify things a lot.
Since splice doesn't map easily to a ring buffer like SMC's, and this is
not a very common path as we have seen, falling back to copy is
acceptable IMO.

Happy to hear if anyone has better ideas.

Best regards,
Dust

  reply	other threads:[~2026-11-04 16:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  8:03 [PATCH net v2] net/smc: don't spin in smc_rx_recvmsg() while a pipe holds spliced data Bryam Vargas via B4 Relay
2026-10-29  8:03 ` Bryam Vargas
2026-10-29  8:06 ` netdev-bot+sinfo
2026-10-29  8:15 ` sashiko-bot
2026-11-03 14:18 ` Paolo Abeni
2026-11-04 16:56   ` Dust Li [this message]
2026-11-04 17:00 ` Dust Li
2026-11-05 10:10 ` patchwork-bot+netdevbpf

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=autjyLEDJ_quR4Nm@linux.alibaba.com \
    --to=dust.li@linux.alibaba.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=guwen@linux.alibaba.com \
    --cc=hexlabsecurity@proton.me \
    --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@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.