Netdev List
 help / color / mirror / Atom feed
From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: Matt Fleming <matt@readmodwrite.com>,
	<choiniere.vincent@hydroquebec.com>
Cc: Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	<intel-wired-lan@lists.osuosl.org>,
	Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
	Michal Kubiak <michal.kubiak@intel.com>,
	Wojciech Drewek <wojciech.drewek@intel.com>,
	Mateusz Polchlopek <mateusz.polchlopek@intel.com>,
	Paul Menzel <pmenzel@molgen.mpg.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>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<stable@vger.kernel.org>, <kernel-team@cloudflare.com>,
	Simon Horman <horms@kernel.org>
Subject: Re: [PATCH net v4] ice: fix Tx hang dump using stale tx_buf[0].skb
Date: Wed, 2 Dec 2026 13:48:19 -0800	[thread overview]
Message-ID: <8a0c9365-87d0-4491-8219-a4a916615921@intel.com> (raw)
In-Reply-To: <awg6SPDYG8JmfzHT@matt-Precision-5490>



On 12/2/2026 5:36 AM, Matt Fleming wrote:
> On Thu, Nov 12, 2026 at 01:45:56PM -0500, Vincent Choiniere via B4 Relay wrote:
>> From: Vincent Choiniere <choiniere.vincent@hydroquebec.com>
>>
>> ice_tx_hang_reporter_dump() always reads tx_ring->tx_buf[0].skb,
>> regardless of next_to_clean. The Tx cleanup path frees the skb and
>> marks the buffer empty without clearing the skb pointer, so slot 0 can
>> hold a stale pointer. A NULL check alone does not cover this, and
>> devlink_fmsg_dump_skb() can fault on the freed skb.
>>
>> Using tx_buf[next_to_clean] alone does not fix the lifetime issues.
>> The dump runs from the service task without synchronization with Tx
>> cleanup or ring replacement:
>>
>> - ice_clean_tx_irq() can free the skb at next_to_clean while the
>>    report is being prepared. It calls napi_consume_skb() before
>>    marking the buffer empty.
>> - The ring saved by ice_tx_timeout() can be replaced or freed before
>>    the service task runs. ethtool -G replaces the ring contents and
>>    frees tx_buf and desc, while ethtool -L can free whole rings.
>>
>> Record the queue index, next_to_clean and next_to_use at timeout time.
>> Before reporting, take RTNL and check that the timeout was on the PF
>> VSI, that the VSI is up and that the timed-out queue still maps to the
>> saved ring. A freed ring can be reused for another queue, so a pointer
>> match alone is not enough. Copy the descriptors and IRQ name while the
>> ring storage is protected against replacement. If the check fails or
>> the copy cannot be made, report only the values recorded at timeout
>> time.
>>
>> As before this patch, a successful snapshot shows the ring when the
>> report is generated. A reset of the same queue after the timeout, for
>> example by ethtool -G or an MTU change, is not detected.
>>
>> Tx cleanup can still run while the ring state is copied, so do not
>> dereference the skb. Retain only its pointer value in the dump and
>> remove the skb contents.
>>
>> Release RTNL before calling devlink_health_report(), which takes the
>> devlink instance lock. Build the dump from the copied data and free
>> the descriptor copy after reporting.
>>
>> This leaves devlink_fmsg_dump_skb() without users; its removal is left
>> to a net-next follow-up.
>>
>> Observed on an E810 PF passed through to a KVM guest with Ubuntu
>> kernel 7.0.0-14 (PREEMPT_RT and a local scheduler patch): a delayed
>> queue IRQ led to a Tx timeout and a page fault in
>> devlink_fmsg_dump_skb():
>>
>>   BUG: unable to handle page fault for address: 0000000004cd0c11
>>   Workqueue: ice ice_service_task [ice]
>>   RIP: devlink_fmsg_dump_skb+0x2d8/0x5d0
>>   Call Trace:
>>    ice_tx_hang_reporter_dump+0x1ce/0x210 [ice]
>>    devlink_health_do_dump+0xcc/0x190
>>    devlink_health_report+0x1d7/0x260
>>    ice_report_tx_hang+0x7d/0xa0 [ice]
>>
>> Fixes: 2a82874a3b7b ("ice: add Tx hang devlink health reporter")
>> Link: https://lore.kernel.org/all/20260327072332.130320-1-aleksandr.loktionov@intel.com/
>> Cc: stable@vger.kernel.org
>> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
>> Signed-off-by: Vincent Choiniere <choiniere.vincent@hydroquebec.com>
> 
> FYI we've been running this patch at Cloudflare for nearly 3 weeks and
> it seems to resolve the crashes we've been seeing during tx timeout.

It looks like this landed before we worked out the direct applying with 
netdev; it'll probably be the faster path. It looks like Przemek already 
reviewed it so if can Vincent re-send it to the list (I'm assuming this 
is the netdev preference), netdev can apply it.

It looks like Simon had some comments [1], but nothing blocking; maybe 
something to consider for a re-send.

The patch looks ok to me. Feel free to add
Acked-by: Tony Nguyen <anthony.l.nguyen@intel.com>

Thanks,
Tony

[1] https://lore.kernel.org/netdev/20261119112409.GU860048@horms.kernel.org/
> Tested-by: Matt Fleming <mfleming@cloudflare.com>


      reply	other threads:[~2026-12-02 21:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 18:45 [PATCH net v4] ice: fix Tx hang dump using stale tx_buf[0].skb Vincent Choiniere via B4 Relay
2026-11-19 11:24 ` Simon Horman
2026-12-02 13:36 ` Matt Fleming
2026-12-02 21:48   ` Tony Nguyen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8a0c9365-87d0-4491-8219-a4a916615921@intel.com \
    --to=anthony.l.nguyen@intel.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=choiniere.vincent@hydroquebec.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kernel-team@cloudflare.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mateusz.polchlopek@intel.com \
    --cc=matt@readmodwrite.com \
    --cc=michal.kubiak@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pmenzel@molgen.mpg.de \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=wojciech.drewek@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox