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=1796046332; b=NRvy/UqOnuRWR5Cc1q5RTZ5tNFA/5PpP424VjPlZ7qYT0eLBgm3MAALsVtdDBxp8TrWJ Ut8JB5KX76LXVloBlJ4q8HZ3mvR43k32mmVVZvehYy6UL3T6CYpfqmFP9MmmmVFerTlq9 IEXcdAV/pYJbjT3p+jge47CERaMYe3iH/kOkJ+RYj1U9YIlgmfxJ6Xk5DiuxqbqKxleJS t5ndXKlhe1i2ES8elEQp1GdNkS6jiLIdGUisBZymnfjOFVH7UBglBPLSn/dA3GM2wuc8t d7oDMF64CIA13R6plucGCIL31LtOXp1TK/1dA7wv4EdGdG6M6pdx7MFlYlT0VD6RoHg== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5975B1F008A0; Mon, 30 Nov 2026 13:45:31 +0000 (UTC) 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== Subject: Re: [PATCH net v2] r8169: recheck the TX descriptor after a vector-map interrupt From: netdev-bot+sashiko@kernel.org To: montrealtango@gmail.com 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 Date: Mon, 30 Nov 2026 13:45:30 +0000 Message-ID: <179604633086.3146.5693012654455711524@kernel.org> In-Reply-To: <20261129134257.2722047-1-montrealtango@gmail.com> References: <20261129134257.2722047-1-montrealtango@gmail.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 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