RE: [PATCH iwl-net v2 2/5] ice: take tc_mutex before the auxiliary device locks in ndo_setup_tc

From: Loktionov, Aleksandr

Date: Fri Oct 23 2026 - 10:58:45 EST




> -----Original Message-----
> From: Petr Oros <poros@xxxxxxxxxx>
> Sent: Friday, October 23, 2026 9:03 AM
> To: netdev@xxxxxxxxxxxxxxx
> Cc: Oros, Petr <poros@xxxxxxxxxx>; Nguyen, Anthony L
> <anthony.l.nguyen@xxxxxxxxx>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@xxxxxxxxx>; Andrew Lunn <andrew+netdev@xxxxxxx>;
> David S. Miller <davem@xxxxxxxxxxxxx>; Eric Dumazet
> <edumazet@xxxxxxxxxx>; Jakub Kicinski <kuba@xxxxxxxxxx>; Paolo Abeni
> <pabeni@xxxxxxxxxx>; Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>;
> Clark Williams <clrkwllms@xxxxxxxxxx>; Steven Rostedt
> <rostedt@xxxxxxxxxxx>; Ertman, David M <david.m.ertman@xxxxxxxxx>;
> Mateusz Palczewski <mateusz.palczewski@xxxxxxxxx>; Leon Romanovsky
> <leon@xxxxxxxxxx>; Rafal Rogalski <rafalx.rogalski@xxxxxxxxx>; Shiraz
> Saleem <shiraz.saleem@xxxxxxxxx>; Loktionov, Aleksandr
> <aleksandr.loktionov@xxxxxxxxx>; intel-wired-lan@xxxxxxxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx; linux-rt-devel@xxxxxxxxxxxxxxx
> Subject: [PATCH iwl-net v2 2/5] ice: take tc_mutex before the auxiliary
> device locks in ndo_setup_tc
>
> The mqprio path of ice_setup_tc() takes pf->adev_mutex and the auxiliary
> device lock first and pf->tc_mutex after them. The dcbnl handlers take
> pf->tc_mutex first and reach pf->adev_mutex through ice_pf_dcb_cfg() and
> ice_send_event_to_aux(). Both run with the RTNL lock held, so the two
> orders do not deadlock against each other, but they form a circular
> dependency for lockdep, and the DCB reconfiguration is about to hold
> pf->adev_mutex for longer.
>
> Take pf->tc_mutex first, which is the order the dcbnl side has used
> since pf->adev_mutex was introduced.
>
> Fixes: 4b31fd4d77ff ("ice: Fix RDMA VSI removal during queue rebuild")
> Signed-off-by: Petr Oros <poros@xxxxxxxxxx>
> ---
> v2:
> - new patch, ice_setup_tc() took pf->adev_mutex before pf->tc_mutex
> while the dcbnl handlers take them the other way round
> ---
> drivers/net/ethernet/intel/ice/ice_main.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
> b/drivers/net/ethernet/intel/ice/ice_main.c
> index 984479f1e1f6d9..8693ca285d5f1e 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -9438,6 +9438,8 @@ ice_setup_tc(struct net_device *netdev, enum
> tc_setup_type type,
> return -EOPNOTSUPP;
> }
>
> + mutex_lock(&pf->tc_mutex);
> +
> cdev = pf->cdev_info;
> if (cdev) {
> mutex_lock(&pf->adev_mutex);
> @@ -9456,15 +9458,14 @@ ice_setup_tc(struct net_device *netdev, enum
> tc_setup_type type,
> }
>
> /* setup traffic classifier for receive side */
> - mutex_lock(&pf->tc_mutex);
> err = ice_setup_tc_mqprio_qdisc(netdev, type_data);
> - mutex_unlock(&pf->tc_mutex);
>
> adev_unlock:
> if (locked) {
> device_unlock(&adev->dev);
> mutex_unlock(&pf->adev_mutex);
> }
> + mutex_unlock(&pf->tc_mutex);
> return err;
> case TC_SETUP_QDISC_ETF:
> return ice_offload_txtime(netdev, type_data);
> --
> 2.56.0

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@xxxxxxxxx>