From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 678B01F000C1; Mon, 30 Nov 2026 09:40:02 +0000 (UTC) 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== From: hawk@kernel.org To: netdev@vger.kernel.org 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 , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Stanislav Fomichev , Toshiaki Makita Subject: [PATCH net 0/3] veth: fix lost NAPI wakeup with threaded NAPI Date: Mon, 30 Nov 2026 10:39:57 +0100 Message-ID: <20261130094000.2022376-1-hawk@kernel.org> X-Mailer: git-send-email 2.43.0 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Jesper Dangaard Brouer 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