Thread (3 messages) flat view 3 messages, 1 author, 18h ago
HOTtoday

[PATCH iwl-net 0/2] igb: PTP Tx timestamp state fixes

From: Shivani Gupta <hidden>
Date: 2026-08-15 01:08:32
Also in: lkml

The igb driver keeps a single outstanding Tx hardware timestamp
request in adapter->ptp_tx_skb, guarded only by the atomic
__IGB_PTP_TX_IN_PROGRESS bit. The fields around it (ptp_tx_skb,
ptp_tx_start) are accessed from the transmit path, the retrieval
worker, the watchdog and the teardown paths without any common
synchronization.

Patch 1 ports the fix igc received in commit 9c50e2b150c8 ("igc: Fix
race condition in PTP tx code") - which the igc series cover letter
already announced as intended for igb - to igb's single-timestamp
model: a new ptp_tx_lock protects the timestamp request state and is
initialized during software setup, before register_netdev() exposes any
consumer. The state bit is removed, and the unsafe cancel_work_sync()
calls in the watchdog path (deadlock with the new lock) and the
atomic-context transmit error path (sleeping while atomic) are dropped
in favor of the worker checking the request state under the lock.
igb-specific paths that do not exist in igc (the 82576 polling worker
with its timeout branch, and transmit error cleanup that verifies slot
ownership) are covered as well.

Patch 2 fixes a related lifecycle bug: disabling Tx timestamping with
a request outstanding strands the request. On re-enable, all new
requests are dropped until the stale one is flagged as a bogus
"Tx timestamp hang" by the watchdog up to 15 seconds later. Pending
requests are now dropped at disable time. The disabled mode and empty
slot are published atomically under the lock introduced by patch 1, so
the transmit path cannot admit a replacement request during cleanup
(which is why the two patches form one series).

Both issues were validated on QEMU's igb (82576) model. The unpatched
disable/re-enable blackout reproduces deterministically (recovery only
via the 15 s watchdog timeout); the final patches complete 100 cycles
without a blackout. A 60-second timestamp stress test with link flaps
delivered 6445 of 6469 requests and completed without a KASAN, lockdep,
DEBUG_ATOMIC_SLEEP, warning, or panic report. The race window itself is
nanoseconds wide and was not directly reproduced; it is identical in
structure to the igc bug fixed by 9c50e2b150c8.

Note: this series touches the same schedule_work() call sites as Kurt
Kanzenbach's pending "[PATCH iwl-next v5] igb: Retrieve Tx timestamp
from BH workqueue" (20260305-igb_irq_ts-v5-1-d3b96828ab5b@linutronix.de).
The overlap is textual only - that patch changes which workqueue runs
ptp_tx_work, this series changes the locking around the request state -
and either rebases trivially on the other.

Shivani Gupta (2):
  igb: Fix race condition in PTP tx code
  igb: Clear pending Tx timestamp requests when disabling Tx
    timestamping

 drivers/net/ethernet/intel/igb/igb.h      |   3 +-
 drivers/net/ethernet/intel/igb/igb_main.c |  49 +++++++-----
 drivers/net/ethernet/intel/igb/igb_ptp.c  | 120 ++++++++++++++++++++----------
 3 files changed, 113 insertions(+), 59 deletions(-)


base-commit: 24ef02f934eeb48830cff6b739abc3c62b1d107b
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help