🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #11098

Re: [PATCH net v2] net/smc: don't spin in smc_rx_recvmsg() while a pipe holds spliced data

#11098
From: Dust Li
Date: Wed, 04 Nov 2026 16:56
39 lines
10405 bytes
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
Technical Details
Message-ID: <autjyLEDJ_quR4Nm@linux.alibaba.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356619-linux-kernel-netdev=dewy.ru
References: <20261029-b4-disp-da7f8e6a-v2-1-9052904adf72@proton.me> <4d97a782-8d88-4dd0-b819-fb704582f2ec@redhat.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356619-linux-kernel-netdev=dewy.ru
From: dust.li@linux.alibaba.com (Dust Li)
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <autjyLEDJ_quR4Nm@linux.alibaba.com>
References: <20261029-b4-disp-da7f8e6a-v2-1-9052904adf72@proton.me>
 <4d97a782-8d88-4dd0-b819-fb704582f2ec@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="3439522"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:9KCX4xTa6u5h0L13Igsj1UfD0HA= sha256:Gub6p2M0xiuBLrW5wfnTCU56rrhtKMQi3sn0aiWhkfM=
	sha1:SPW2wdUFHkRSHKqLvWr3l4j2aCw= sha256:S00PSS6XQK7czUmhZtvQRKEeQVNBD+KlqjYAfsOl+4s=
Content-Disposition: inline
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 505D0112C83; Wed,  4 Nov 2026 20:28:46 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -10.55
X-Spam-Status: No, score=-10.55 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_DKIM_WL=-7.5]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=linux.alibaba.com
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 DOujojXTlKxe;
	Wed,  4 Nov 2026 20:28:42 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-356619-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id CC5D9112C12; Wed,  4 Nov 2026 20:28:32 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id C7EEB36EFA; Wed,  4 Nov 2026 16:57:12 +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=1793811418;
	b=LyUmtpALJVaOd41amiZwnMp4WI/i8tY1tHgwhyCpJTSGJI+EkR0JY/B1LJXGiDUnYq6r
	 En2vJok3SGlkWZwnloxF5i0SfhDj1C9RioOylPmcyvjgtsmhhwrlQhcUTpU8Ax4OtnYgm
	 13W4uuGWJxztOWF91gWRL7QJbtFzHMqB4PLsY41n7siadWk2EknLTqY3ae0VnjSzFrb+c
	 XVhsgCo/J7fGJzG0DAMlYMW2F2ozgV1lfLzdSd2uKzNzHuQXiiwnEnS8DBHf3bOfhNPBD
	 7yjO78ZsDiLxITYurvMNequV5HMC9opHu79cPTmneaRjXmYfwfwmd2PKYLkkmCZm0/w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793811418;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:
	 X-Alimail-AntiSpam:Received:Date:From:To:Cc:Subject:Message-ID:
	 Reply-To:References:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Type:Content-Disposition:In-Reply-To;
	bh=7oCUzc0IQ+/X/VuHpS7xyE9gBpY1n2hc0ad7jzb6Ehw=;
	b=ArG7djdbKlxQs/9Wad1JynCO5m5Vgl1Cc08GI9ipSpXD+8bGfFlx6YTdWc1nxGM2Isf5
	 Xyd3pNjYrC5sHZMvQkT27q4t5DY9PYZJlztZjs8e9YHw1Wx7hCTGC6MrkNpU2grltS/R7
	 2n9xG/D7ooqHHf+C5UG0I39lGFmp+graK/G+1OM8r4owspIn3G57clEKXyTxnYOXpslBl
	 ZZMlfwq0UhVjHT3QnKN2rRRbutNFF4IiBLc2Unt5hGTzUKMz5iYgB5D7NDVcW5gOokZ5K
	 iniD0rphEhvzohz+kj6oYNYTFyyE+ftfBwaCoaz1OAq2E+PHrCdlV2ZpU+iYv/cAb8A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=mqOaBcjR;
	dmarc=pass header.from=linux.alibaba.com;
	spf=pass smtp.mailfrom=linux.alibaba.com;
	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 03BFA606D824;
	Wed,  4 Nov 2026 16:56:58 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=mqOaBcjR
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.131
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793811411;
	b=tB0E/JLKheOElIrsYEiB4J7d6sEzYDLpe1HJrQjUNZT9JkZRqXVZOFEuSsar7aIBcl50
	 RNyDhWy72DAG0U9cOfqvpGUwSZoNkz040i17OCa983uAmBA0akLumuGvoRqrsvtR/6dV5
	 4CB7jh5gG3VPCj0AREhdaJ65q5Elyx10D9x38xPaR4CFdl4eAtHkljEidnvBR2ArF6YsY
	 btBb+cHejc7FNmIO1RHAKk2Ulh5HsKF+vBt53mokyF5BfIXnaCalCaJ6v2tZHkc/zAWgZ
	 iyWIgCmKkWLg2UjUSQqzORjI2ggtHBuzl4NiC8ErJJOP1OkeVhop2aoYw3FIBTKpH4w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793811411;
	h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:Date:From:To:
	 Cc:Subject:Message-ID:Reply-To:References:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To;
	bh=7oCUzc0IQ+/X/VuHpS7xyE9gBpY1n2hc0ad7jzb6Ehw=;
	b=JqeMU1HbckVczoRcweA15kajEGoDWhEZ6j9/88qR0S1aPmtI0VF07jpFdCO4p5E1Zfzk
	 kLB/j0jQtXrXbcFZBO2j0a2feEwKUOZeB+A2puavJUUkygtTKjDA/R0lk/SjjNbRT9ftE
	 yh1CzIsnH908RpU1f+B/Q/gwdVmyCJuaH1gSouLX+oq9FErGUfIetnxX4D7WOZo/wUJGx
	 a3IZwrlO1yW3uuYwrTLZ/hubqRwN8cVHrANWzf/nAw1gUk/WQFf2yk1vWOo0tWl3Yitph
	 zMX8ekZPc3Xs2TKr2eEN1NI1o3Zm2uB+uvfJDmSvtIdFSIT6oS8iZCaki4jzLQCLZ5A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linux.alibaba.com;
	spf=pass smtp.mailfrom=linux.alibaba.com;
	dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=mqOaBcjR;
	arc=none smtp.remote-ip=115.124.30.131
X-Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC3BB606A329;
	Wed,  4 Nov 2026 16:56:49 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BC3BB606A329
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=linux.alibaba.com; s=default;
	t=1793811401; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type;
	bh=7oCUzc0IQ+/X/VuHpS7xyE9gBpY1n2hc0ad7jzb6Ehw=;
	b=mqOaBcjRpqGpjCGLVzSSRUeVouDO/Ewh7UfRw6Wwf+fNKP31s1voVAX4AQofQ2zLAm0XXJbmrLtGePnFwmq4ixu32m2FLvUxD/S59b3s6Q9nUTmgOC4RMk7Xxnf74VoEeGqQkE2nuThQXQThuDEJcWHJ4Rh6DLoCJhq6GHggoak=
X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam011083073210;MF=dust.li@linux.alibaba.com;NM=1;PH=DS;RN=19;SR=0;TI=SMTPD_---0XE6Ix9y_1793811400;
X-Received: from localhost(mailfrom:dust.li@linux.alibaba.com fp:SMTPD_---0XE6Ix9y_1793811400 cluster:ay36)
          by smtp.aliyun-inc.com;
          Thu, 05 Nov 2026 00:56:40 +0800
X-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
X-Reply-To: dust.li@linux.alibaba.com
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
X-In-Reply-To: <4d97a782-8d88-4dd0-b819-fb704582f2ec@redhat.com>