๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24638

Re: [PATCH net v2] r8169: recheck the TX descriptor after a vector-map interrupt

#24638
From: netdev-bot+sashiko
Date: Mon, 30 Nov 2026 13:45
98 lines
11624 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The fix may not close the TX stall it targets.

--

r8169: recheck the TX descriptor after a vector-map interrupt

With the vector-map interrupt model, the TX MSI-X interrupt can arrive
before the descriptor write-back is visible to the CPU. In that case
rtl_tx() stops at a descriptor that still looks owned by the chip. When
irq_nvecs > 1, this patch reads ISR_VEC_MAP_REG once to flush the
write-back and then checks the first pending descriptor once more.

> diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
> index f151ab6813932..844c48119028f 100644
> --- a/drivers/net/ethernet/realtek/r8169_main.c
> +++ b/drivers/net/ethernet/realtek/r8169_main.c

[ ... ]

> @@ -5237,8 +5238,18 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
>  		u32 status;
>  
>  		status = le32_to_cpu(READ_ONCE(tp->TxDescArray[entry].opts1));
> -		if (status & DescOwn)
> -			break;
> +		if (status & DescOwn) {
> +			/* The vector-map TX interrupt can arrive before the
> +			 * descriptor write-back is visible. Reading the
> +			 * interrupt status register makes it visible, as in
> +			 * the legacy handler; look once more.
> +			 */
> +			if (!recheck)
> +				break;
> +			recheck = false;
> +			RTL_R32(tp, ISR_VEC_MAP_REG);
> +			continue;
> +		}

[Severity: Medium]
Does this fully close the TX stall it targets, or only make it less likely?

A non-posted MMIO read only orders posted writes that the device has
already queued ahead of the read completion. It does not stop the chip
from answering the ISR_VEC_MAP_REG read before it has queued the
descriptor write-back.

The commit message says the TX MSI-X can arrive before the write-back is
visible. Both of those are posted writes from the chip, so the chip can
evidently signal completion before the write-back is ordered.

Is there a Realtek guarantee that the ISR_VEC_MAP_REG read completion is
ordered behind the TX write-back in vector-map mode? The comparison with
the legacy handler looks empirical. The legacy handler also does its read
in hard IRQ context, not from NAPI.

If the second look still sees DescOwn, the loop breaks and nothing
revisits the descriptor. The vector's ISR bit was already cleared in
hard IRQ:

rtl8169_interrupt_msix()
    rtl8169_disable_hw_interrupt_msix(tp, message_id);
    rtl8169_clear_hw_isr(tp, message_id);
    napi_schedule(napi);

and rtl8169_poll_msix_tx() then re-arms without checking the ring again:

    rtl_tx(dev, tp, budget);

    if (budget && napi_complete_done(napi, 0))
        rtl8169_enable_hw_interrupt_msix(tp, (int)(napi - tp->rtl8169_napi));

Suppose that descriptor was the last one in flight, for example after BQL
stopped the queue. Then no later TOK interrupt would arrive, the
completion would stay unreaped, and the netdev watchdog would reset the
chip. That is the failure the commit message describes.

Would a fallback make sense if the single flush is not enough? Options
include a bounded retry, rescheduling NAPI, or rechecking the ring after
re-arming the interrupt.

>  
>  		skb = tp->tx_skb[entry].skb;
>  		rtl8169_unmap_tx_skb(tp, entry);

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129134257.2722047-1-montrealtango%40gmail.com
Technical Details
Message-ID: <179604633086.3146.5693012654455711524@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374234-linux-kernel-netdev=dewy.ru
References: <20261129134257.2722047-1-montrealtango@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374234-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2] r8169: recheck the TX descriptor after a vector-map interrupt
Date: Mon, 30 Nov 2026 13:45:30 +0000
Organization: Usenet Network
Message-ID: <179604633086.3146.5693012654455711524@kernel.org>
References: <20261129134257.2722047-1-montrealtango@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="1437024"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:NE98PT4UYsUNwqpUd42o8oz6wDM= sha256:3pc1Za5mqXONLvm+rvTBWfmXQhWN1q/IAph0ucr8MhE= sha1:zCMhopOInApSJrAsVi5RsDQ1jlk= sha256:V3v55Ys4QsXHB5Rwvd2LMo/pCksHf8KudgmGEOM6RC0=
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 5CA9A125FF4; Mon, 30 Nov 2026 16:45:52 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, 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 Hqoqo_BlfxEa; Mon, 30 Nov 2026 16:45:48 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374234-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 4A8C4125FF1; Mon, 30 Nov 2026 16:45:37 +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 3FF7A29C90; Mon, 30 Nov 2026 13:45:33 +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=1796046333; b=mtV4mscBoN8PRw6+LBTruYYD1IyR3lyhlLQI2nWdGT+1dqjLEhFPsHPexpkRptXnlHDH U0O32yKUHKZNjJPRIiVWe55QRxo9+K72V1PvyNv+ykoeF2+WkWrRS+kntq4Oc/sjeJ0Yi S6kmJvpn6uoJ88DBQKD24lslJvvf2ADE6C/cpaLTX8TrD816k4kgh7QICWzDSFJMgU0IK +hicu0DEv3PDuN3D3UZ77bplgPL585w+QbBllppm/5dP6+JZGsXtFnb3JXMqMophQ/Um7 bJcjSz4G9c9MGU9SWyLjT9wto9OoNY/X76qMUsQINVo5NOHo+McSnokIfyxlqb0QZ+g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796046333; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=c8aUjdYWp53I8EejhyiUDkwoyjGpWFCtnoL3OGG8zZI=; b=FErjacbSje0ywpjXEGitNP8gSl/GhP1VF370gmcXTqZADPFvQc12S3udxrwRU1r5RBXI OaUWF3nwuEDrQ4GhF4T0gBI76dUL6sPogPGgJkPZuHHkws/6aEjBobc0gK2jnB8XFxyOU bHq5CveilAz0FURgOg6ISkF8yfGLkAS6/s/aKhiDoGfsDTYl3Oy7zeY/ra6AWEPECtgH4 sHgUCeOnJFZcyqSqCVTcwo5m2oXCc/4v3U31tdxyW2QzrB7KU3nd7JP6KmBPt9sC8CfaY mEpb3LtjrmQH73vnCSIkhkT2y7YZ0ItBVZ889KymmKnjxQWtgGGm5q7LKbzlRXdR4VA==
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=VYrCQ54r; 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 160E5606A32C; Mon, 30 Nov 2026 13:45:33 +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=VYrCQ54r
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=1796046332; b=NRvy/UqOnuRWR5Cc1q5RTZ5tNFA/5PpP424VjPlZ7qYT0eLBgm3MAALsVtdDBxp8TrWJ Ut8JB5KX76LXVloBlJ4q8HZ3mvR43k32mmVVZvehYy6UL3T6CYpfqmFP9MmmmVFerTlq9 IEXcdAV/pYJbjT3p+jge47CERaMYe3iH/kOkJ+RYj1U9YIlgmfxJ6Xk5DiuxqbqKxleJS t5ndXKlhe1i2ES8elEQp1GdNkS6jiLIdGUisBZymnfjOFVH7UBglBPLSn/dA3GM2wuc8t d7oDMF64CIA13R6plucGCIL31LtOXp1TK/1dA7wv4EdGdG6M6pdx7MFlYlT0VD6RoHg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796046332; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=c8aUjdYWp53I8EejhyiUDkwoyjGpWFCtnoL3OGG8zZI=; b=hsf3gUsXbx64VwO4+ZbRXaylVlH1kYo5iqu++aqkwcQ93gyRvP3CfuFkfM1LiiVoHxyj +JViqKX1p2uUhMx6GIh+1HJVbiUTpLfxQ/3ygeWSlJB3TDQDuyideN+G7KgqPNSdJzFAD xBiIZxpL2O58Dmtn+QyG5KBeJxIF3WRCCsyiBanzXy2PW9K7z1gjXmvsT/7fkmt3mz2Zd D8wfYIKJm3ck7z+EZnXrBBhkyCyQvNHczk9lo2BenEQZ5reWogKtXhDUabmAz+X3hTBU8 LzcMsMRBa3uKwQ44edDgi8j9QV/5ZpeI7HTU5IsIG+q2w1+d5SaU0phOt5NyeKPjNoA==
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=VYrCQ54r; 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 34975606A320; Mon, 30 Nov 2026 13:45:32 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5975B1F008A0; Mon, 30 Nov 2026 13:45:31 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796046331; bh=c8aUjdYWp53I8EejhyiUDkwoyjGpWFCtnoL3OGG8zZI=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=VYrCQ54r7F2iwSKxjrpuABvUFQ6DW0TzjrigqcXf3yYFhSoVGWhTKV/Cdo/Fjs3md MxE5I7p+Q7s0u08U4PtMRY8a8K8wtNH8JxRWNOMMsHbDHWELehbsjWLKC9m4z7icI7 LJH3vYBtFoloKmCMKmyPN+VpLmF02pmARo3+VhzTvkTJx8eqoODLJcoDptnFAKOiPs cqYoQe+4YngOrjdGGRY7fMk2AXgLCrBOc0gRuraIshTOzraCg/bQXGjY2fT911x09j A5pzP2SRkiVvxYo+XHbnd+rf4hJq9h0zxgJH1OmFR/CfI/r2pwWLOQW9aJOVL0+XyA aw+Mh8Tmbvc+A==
X-Cc: netdev@vger.kernel.org, hkallweit1@gmail.com, javen_xu@realsil.com.cn, nic_swsd@realtek.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org
X-In-Reply-To: <20261129134257.2722047-1-montrealtango@gmail.com>
X-sashiko-severity: Medium
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-Received-Bytes: 11338