Subject: Re: [PATCH net-next 5/7] net/mlx5: E-Switch, block representors during reconfiguration

From: Jakub Kicinski <[email-masked]>
Date: Mon, 13 Apr 2026 15:22:29 -0700

On Thu, 9 Apr 2026 14:55:48 +0300 Tariq Toukan wrote:
> A spinlock is out because the protected work can sleep (RDMA ops,
> devcom, netdev callbacks). A mutex won't work either: esw_mode_change()
> has to drop the guard mid-flight so mlx5_rescan_drivers_locked() can
> reload mlx5_ib, which calls back into mlx5_eswitch_register_vport_reps()
> on the same thread. Beyond that, any real lock would create an ABBA
> cycle: the LAG side holds the LAG lock when it calls reps_block(), and
> the mlx5_ib side holds RDMA locks when it calls register_vport_reps(),
> and those two subsystems talk to each other. The atomic CAS loop avoids
> all of this - no lock ordering, no sleep restrictions, and the owner
> can drop the guard and let a nested caller win the next transition
> before reclaiming it.

You gotta explain to me how a busy loop waiting for a bit to go 
to "UNBLOCKED" state is anything else than a homegrown lock :S

Also what purpose does the atomic_cond_read_relaxed() serve?
I haven't seen it being used before.