Article View: linux.kernel.netdev
Article #24536[PATCH net 0/3] veth: fix lost NAPI wakeup with threaded NAPI
From: hawk
Date: Mon, 30 Nov 2026 09:39
Date: Mon, 30 Nov 2026 09:39
59 lines
10469 bytes
10469 bytes
From: Jesper Dangaard Brouer <hawk@kernel.org>
On ARM64 servers (Ampere Altra Max) with threaded NAPI, veth TX queues
can stall permanently. The peer rq has rx_notify_masked set while its
NAPI is idle. Producers then skip scheduling NAPI, and nothing drains
the ptr_ring. With a qdisc, the TXQ stays stopped, because of commit
dc82a33297fc ("veth: apply qdisc backpressure on full ptr_ring to
reduce TX drops"). Without a qdisc, veth silently drops all packets for
that queue.
The cause is a missing write barrier. __veth_xdp_flush() stores
rx_notify_masked = true, then __napi_schedule() sets
NAPI_STATE_SCHED_THREADED with a relaxed set_bit(). On ARM64 the second
store can become visible first. An awake NAPI kthread on another CPU
then runs a full poll and stores rx_notify_masked = false, and the late
true store lands after it. Commit 68468d8c4cd4 ("veth: fix races around
rq->rx_notify_masked") opened this window, when it moved
napi_schedule_prep() before the store.
Patch 1 is a failsafe. It enables dev_watchdog for veth and recovers
the peer NAPI on TX timeout. A TXQ wake alone does not help, because
veth_xmit() hits the full ring and stops the TXQ again. We found the
bug fixed by commit 5442a9da6978 ("veth: more robust handing of race to
avoid txq getting stuck") with a similar watchdog patch in production.
Patch 2 is the fix: smp_wmb() in __veth_xdp_flush().
Patch 3 adds the same barrier to the re-arm path in veth_poll(). That
path can only race when a socket busy-polls a threaded NAPI. The patch
moves the schedule sequence into one helper, so both paths share it.
herd7 litmus tests back both patches, for LKMM and for herd7's arm64
model. Without a barrier, the bad state is reachable. With patch 2
only, it is still reachable through the busy poll re-arm. With both
patches, no test reaches it. Tests and results:
https://github.com/netoptimizer/veth-backpressure-performance-testing/pull/15
Testing: in virtme-ng we starved the peer NAPI kthread for 12 seconds
under a UDP flood, on 6.18 and on the net tree. The watchdog fired, the
queue recovered, and the kernel log had no warnings. The test cannot
reproduce the ARM64 race, but it shows that the watchdog recovery
works. selftests/net/veth.sh passes. The test is here:
https://github.com/netoptimizer/veth-backpressure-performance-testing/pull/14
Jesper Dangaard Brouer (2):
veth: enable dev_watchdog and recover stalled peer NAPI
veth: order rx_notify_masked store in the veth_poll() re-arm path
Marek Kroemeke (1):
veth: order rx_notify_masked store before __napi_schedule()
drivers/net/veth.c | 63 ++++++++++++++++++++++++++++++++++++++--------
1 file changed, 52 insertions(+), 11 deletions(-)
--
2.43.0
Technical Details
Message-ID:
<20261130094000.2022376-1-hawk@kernel.org>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374075-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374075-linux-kernel-netdev=dewy.ru From: hawk@kernel.org Newsgroups: linux.kernel.netdev Subject: [PATCH net 0/3] veth: fix lost NAPI wakeup with threaded NAPI Date: Mon, 30 Nov 2026 10:39:57 +0100 Organization: Usenet Network Message-ID: <20261130094000.2022376-1-hawk@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1395208"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:SUwo8bdaB7WmHK44KpWjQGo0VQ4= sha256:JBIYx8bNOhWYmQNQoP9J1dEhH8DpyJ0n7wNXNaVAQC8= sha1:/Ikf/VZlB7PtHBX/BsvQVGp4FpQ= sha256:mdPnYXpWSqv3F36v10SF8dnSD5JfwuRcPRN4zDZI8iM= 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 EB351125FD6; Mon, 30 Nov 2026 12:40:30 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 wF77mzzUQRbI; Mon, 30 Nov 2026 12:40:23 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374075-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 27F2D125FD4; Mon, 30 Nov 2026 12:40:13 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 4870724402; Mon, 30 Nov 2026 09:40:10 +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=1796031607; b=VNYhXXP6FsLxCbIZqdmmnN/YXVEOBUz3/VyaHE3sFkX9cliYBD3rYJTJZpDk2gMOwwio 2pQ+3TJTlRZRpvCldELsEg+6QpzMnTVIfd5ka42iv89uDxn9nyPZ0Nk6SK6Lz4WYpWror GnzTLr8JO+iDtUHxMEqs7dFBX6RrvLrBhTbTuJtAHBfuvwxUBXjRpUklQf8fOUTS5xZ0O ItgLXiToRorS2NZSuOebNOvAmPDKKT0UUHmD+1NC6Jw0Bbpeg7q076rHYiG5XocGLvrrR DcpmAlYxmeu4D+Z68SbfnGgpKf8L/S45AbH1+Alfxosnr9YZdkKpvLsx0ESyJrYI1iQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796031607; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=qEoE7G/4I2z/ZJitY+3BOTD+FktANRg+ZUUwlDFTPtE=; b=g7NXP4PwafLdkieXSocV0MGl7RN0vBmoJHkivpjTM6pN9QPXewybk71rUijiRKBo5QEh Jpfpy4FAt06Ti0GfpoaSm4I93Jpdrc2W+RcTv10+qygWPTU0aUILbiatgPtkAy3dHJ7vz ywByHYu9wsdM3Ucktf7iH3z1MzWvwtmHCic9UfmMZYtMEqKu+Cbqd9IF/Mtod4RrKfj54 paFS5Zj/rG3VFP+KffxJmcCP0t9yxuoVOKNVbBKMFY815Fl7ejECME8e7gi/Z3vNgl62g IXyYxBbqjKKV9RIn2mKSyFA4ErQh+T4RxIdPSIA7WKHOWlCZUwIV7oocX9L7ML7lVdw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KMBwkYHq; 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 86DE1606A330; Mon, 30 Nov 2026 09:40:07 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KMBwkYHq X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796031606; b=X5z6jX6lfSpBPwAoai/jZqBSq8CweUD8BGsNnH+S+BXb0KTaYus7SbVq7EYt67Lgmr7/ 6ilXKAMPJ61cxfzh04H7XkfE7u+u1vPCPO46vevFk87qdOIDrkKO1OXx1LFYDDK8JGGyp opc/3Lvq5Dj0+vRMjZLa+rAnw+AIMQI620eaIN3flAP2tP7chw9hph5CQBv8jJjYrWIQZ rlucIj7Vz2I03lMnvzGVLRS4zmZ0cBaCebgpbstgE/i+y7vzvp1xAirE/TEVxPkDsbT9w SlBalzf3nil5V0uWD4UMia1wsvsrKinf38W0EsGB8ktFA8SslHvHS0nq5FzGaLoZTqQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796031606; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=qEoE7G/4I2z/ZJitY+3BOTD+FktANRg+ZUUwlDFTPtE=; b=isbgCNylhqnGJJaeQDa5eqvgLTd5hF1GADI8q7uWpExZ2EmcZ5UXcDf+VFe7RdPkpIeL c8RufJ/sqQHknPKuxo1xQ2FkBjZDsZbmkRSLY2cWP5dXYo43NmZrhMCvCo/6aqd/3PNlV 6KiEPdQcjZ2NUwciJRB2RsxwLyQpGiOzCKDQQVeg4qugw+919DCj81N7vagFQnXcLTZXT tMTJQUUXmMYyxIu6v/pZruR6MLfNhGyZ3khO/BPXHzyjKwB71tep0IHACsdM6RlbrnuMc M3h+0h5xlU6dFc/A6oqeyLikO/TxHjDqrVqP/TdlLU9CERYAcGYs5GjZ/8aqQOTdN/A== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KMBwkYHq; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A26CA606A31C; Mon, 30 Nov 2026 09:40:06 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 678B01F000C1; Mon, 30 Nov 2026 09:40:02 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796031605; bh=qEoE7G/4I2z/ZJitY+3BOTD+FktANRg+ZUUwlDFTPtE=; h=From:To:Cc:Subject:Date; b=KMBwkYHqxA3rHI1jUJ5B34FgeAexC4GQXJwjrHm2ei5pYcGT1I7ZWMWht1CXwwXn9 BNFlDxF7ob6HNCFfJ3jUFl6JLFVirq0npG/aag5gMNTteixRofLBNR/U8oi3n3E/GN RldkYSjJhLjoBJ2hPcjsgTz8yyLsCsCyLqO0NYMo/W8Umun019gRRnTsAvsdAI2gwb tMqjApXWoqe8NSTEEoEDGsMjL55ylx5aTUQAfsMnVavL+DzGq3uiwuo/obW4Z0o2XW RHlFdk2Fg6MDQ2JWc5erTBGoCEkSmJliG3zmEiiN00tLuCy6eoP8Is/AK8HyJAOI4V fbk584DrOeh7w== X-Cc: bpf@vger.kernel.org, mkroemeke@cloudflare.com, matt@readmodwrite.com, kernel-team@cloudflare.com, hawk@kernel.org, simon.schippers@tu-dortmund.de, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, John Fastabend <john.fastabend@gmail.com>, Stanislav Fomichev <sdf@fomichev.me>, Toshiaki Makita <toshiaki.makita1@gmail.com> X-Mailer: git-send-email 2.43.0 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