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 <choi…@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/2026…@intel.com/
>> Cc: stab…@vger.kernel.org
>> Reviewed-by: Przemek Kitszel <prze…@intel.com>
>> Signed-off-by: Vincent Choiniere <choi…@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 <anth…@intel.com>
Thanks,
Tony
[1] https://lore.kernel.org/netdev/2026…@horms.kernel.org/
> Tested-by: Matt Fleming <mfle…@cloudflare.com>