Re: [PATCH] net: atheros: atl1e: use atomic functions with memory barriers for next_to_clean

From: Jakub Kicinski

Date: Mon Apr 27 2026 - 20:59:51 EST


On Wed, 22 Apr 2026 17:37:17 +0800 Gui-Dong Han wrote:
> Found by auditing atomic operations used for synchronization.
> A similar fix can be found in 6df8e84aa6b5.
>
> Do not change atl1e_init_ring_ptrs(). Its atomic_set() runs during
> bring-up before NAPI and interrupts are enabled, so it is not a runtime
> publication point between Tx cleanup and Tx submission.
>
> In my opinion, implementing ad-hoc lockless algorithms directly within
> individual drivers is highly error-prone. To avoid these subtle memory
> ordering and barrier bugs, drivers should rely on established, well-tested
> kernel libraries like kfifo to handle this type of concurrency.

I don't think this is sufficient, we can still race stop vs wake.
Please convert the driver to use netif_txq_maybe_stop() and friends.
--
pw-bot: cr