On Thu, Nov 12, 2026 at 01:45:56PM -0500, Vincent Choiniere via B4 Relay wrote:
> From: Vincent Choiniere <[email protected]>
> 
> 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/[email protected]/
> Cc: [email protected]
> Reviewed-by: Przemek Kitszel <[email protected]>
> Signed-off-by: Vincent Choiniere <[email protected]>

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.

Tested-by: Matt Fleming <[email protected]>

Reply via email to