Re: [PATCH net v4 1/2] net: atl1c: wait for in-flight RX polls before the link-down ring reset
From: Federico Musto
Date: Wed Nov 25 2026 - 06:34:56 EST
Thank you for the review. A two-patch v5 addressing the findings is
posted here:
https://lore.kernel.org/netdev/20261125113120.99743-1-federico@xxxxxxxxxxxxx/
[High] "This patch does not close the RX race it claims to fix."
Correct. In v5, atl1c_rx_poll_sync() returns bool and, when __AT_DOWN
appears while waiting, the link-down handler skips the reset entirely
instead of proceeding without having waited. Skipping is safe: every
setter of __AT_DOWN is a teardown path that napi_disable()s all queues
and then runs atl1c_reset_dma_ring() itself, so the rings are reset
with NAPI quiesced by the teardown that owns them. The handler runs
again on the next link-change event.
On the remark that the loop "polls another context's state bit and its
exit condition does not synchronise with the poll": the wait now pairs
with the polling side. The handshake is a store-buffer pattern - the
work item stores the carrier-off state and then loads
NAPI_STATE_SCHED, while the scheduling side stores NAPI_STATE_SCHED
(the cmpxchg in napi_schedule_prep()) and the poll then loads the
carrier. A full barrier between store and load on each side (an
explicit smp_mb() after netif_carrier_off() here) guarantees that
either the work item sees the in-flight poll and waits for it, or the
poll sees the carrier off and returns at entry without touching the
rings.
[Medium] Unbounded wait with threaded busy-poll.
Correct. The wait is now bounded: 500 iterations of
usleep_range(1000, 2000), about 0.5-1 s. On timeout the work item logs
a ratelimited warning and skips the reset - it never resets under a
possibly live poll - and re-enables interrupts, so later link-change
events are handled. The reset is likewise skipped when __AT_DOWN
appears (above). In both cases the rings are left to their owner and
the link-down event falls back to the pre-5e5c0964d9b9 behaviour (no
MAC reset), which is degraded but safe.
[High, pre-existing] TX side of the same reset.
Acknowledged and still out of scope for this series: it belongs to the
serialisation of the work item against the atl1c_down() callers, which
the changelog defers. Unchanged in v5, restated under the ---.
One runtime observation from the v5 hardware validation (emulated
AR8151 on a MikroTik CCR2004-1G-2XS-PCIe): twice, about 1.3 s after an
MTU change and immediately before the device signalled link down, the
IOMMU blocked a DMA read from the device to an unmapped address. Both
faults precede the link-down interrupt, so they happened before any
code touched by this series ran for that event. I have not established
the cause; reported here and in the cover letter as an observation
only.
pw-bot: cr