* [PATCH iwl-net 1/3] ice: avoid RTNL deadlock when notifying the RDMA auxiliary driver
2026-10-19 6:52 [PATCH iwl-net 0/3] ice: fix RTNL vs auxiliary device lock inversion Petr Oros
@ 2026-10-19 6:52 ` Petr Oros
2026-10-21 11:20 ` Loktionov, Aleksandr
2026-10-19 6:53 ` [PATCH iwl-net 2/3] ice: do not block on the aux device lock in ethtool set_channels Petr Oros
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Petr Oros @ 2026-10-19 6:52 UTC (permalink / raw)
To: netdev
Cc: Petr Oros, Tony Nguyen, Przemek Kitszel, Andrew Lunn,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Dave Ertman, Shiraz Saleem, Leon Romanovsky, Kamil Maziarz,
Rafal Rogalski, Aleksandr Loktionov, Michal Schmidt, linux-rdma,
intel-wired-lan, linux-kernel, stable, Sebastian Andrzej Siewior,
Clark Williams, Steven Rostedt, Mateusz Palczewski,
linux-rt-devel
ice_send_event_to_aux() blocks on the auxiliary device lock, and the
dcbnl callers reach it with the RTNL lock held. The RDMA auxiliary probe
takes the two in the opposite order, because __driver_attach() holds the
auxiliary device lock across ib_register_device(), which needs the RTNL
lock:
systemd-udevd state:D
really_probe <- holds device_lock(&adev->dev)
icrdma_probe
irdma_ib_register_device
ib_register_device
setup_device
irdma_roce_port_immutable
ib_query_port
irdma_query_port
ib_get_eth_speed <- blocks on rtnl_lock()
lldpad state:D
rtnetlink_rcv_msg <- holds rtnl_lock()
dcb_doit
dcbnl_ieee_set
ice_dcbnl_setets
ice_pf_dcb_cfg
ice_send_event_to_aux <- blocks on device_lock(&adev->dev)
Everything else that needs the RTNL lock piles up behind lldpad and the
boot never completes. The probe side cannot be changed, so use
device_trylock() and report whether the event reached the driver.
IIDC_RDMA_EVENT_BEFORE_TC_CHANGE has to arrive before the traffic
classes change, so ice_pf_dcb_cfg() refuses the request with -EBUSY
rather than run it behind the RDMA driver's back. The critical error and
MTU change events are sent from the service task, which consumes their
pending bits before sending, so those are re-armed instead.
AFTER_TC_CHANGE keeps its fire and forget behaviour, it can be neither
refused, the hardware has already changed, nor deferred, every lock that
would serialise a deferred delivery against the dcbnl callers forms
another cycle.
Fixes: 348048e724a0 ("ice: Implement iidc operations")
Cc: stable@vger.kernel.org
Signed-off-by: Petr Oros <poros@redhat.com>
---
drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 9 ++++++++-
drivers/net/ethernet/intel/ice/ice_idc.c | 20 ++++++++++++++++----
drivers/net/ethernet/intel/ice/ice_idc_int.h | 2 +-
drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++----
4 files changed, 37 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
index 0bc6dd37568792..2022b46c990cb2 100644
--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
@@ -355,8 +355,10 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked)
struct iidc_rdma_event *event;
int ret = ICE_DCB_NO_HW_CHG;
struct ice_vsi *pf_vsi;
+ bool dcb_ena;
curr_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg;
+ dcb_ena = test_bit(ICE_FLAG_DCB_ENA, pf->flags);
/* FW does not care if change happened */
if (!pf->hw.port_info->qos_cfg.is_sw_lldp)
@@ -406,7 +408,12 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked)
}
set_bit(IIDC_RDMA_EVENT_BEFORE_TC_CHANGE, event->type);
- ice_send_event_to_aux(pf, event);
+ if (!ice_send_event_to_aux(pf, event)) {
+ assign_bit(ICE_FLAG_DCB_ENA, pf->flags, dcb_ena);
+ kfree(event);
+ ret = -EBUSY;
+ goto free_cfg;
+ }
kfree(event);
/* avoid race conditions by holding the lock while disabling and
diff --git a/drivers/net/ethernet/intel/ice/ice_idc.c b/drivers/net/ethernet/intel/ice/ice_idc.c
index 102d63c3018b1f..7fd35ce966ea65 100644
--- a/drivers/net/ethernet/intel/ice/ice_idc.c
+++ b/drivers/net/ethernet/intel/ice/ice_idc.c
@@ -34,30 +34,42 @@ ice_get_auxiliary_drv(struct iidc_rdma_core_dev_info *cdev)
* ice_send_event_to_aux - send event to RDMA AUX driver
* @pf: pointer to PF struct
* @event: event struct
+ *
+ * Return: false when the auxiliary device lock was contended.
*/
-void ice_send_event_to_aux(struct ice_pf *pf, struct iidc_rdma_event *event)
+bool ice_send_event_to_aux(struct ice_pf *pf, struct iidc_rdma_event *event)
{
struct iidc_rdma_core_auxiliary_drv *iadrv;
struct iidc_rdma_core_dev_info *cdev;
+ bool sent = true;
if (WARN_ON_ONCE(!in_task()))
- return;
+ return true;
cdev = pf->cdev_info;
if (!cdev)
- return;
+ return true;
mutex_lock(&pf->adev_mutex);
if (!cdev->adev)
goto finish;
- device_lock(&cdev->adev->dev);
+ if (!device_trylock(&cdev->adev->dev)) {
+ dev_dbg(ice_pf_to_dev(pf),
+ "auxiliary device busy, dropped RDMA event 0x%lx\n",
+ *event->type);
+ sent = false;
+ goto finish;
+ }
+
iadrv = ice_get_auxiliary_drv(cdev);
if (iadrv && iadrv->event_handler)
iadrv->event_handler(cdev, event);
device_unlock(&cdev->adev->dev);
finish:
mutex_unlock(&pf->adev_mutex);
+
+ return sent;
}
/**
diff --git a/drivers/net/ethernet/intel/ice/ice_idc_int.h b/drivers/net/ethernet/intel/ice/ice_idc_int.h
index 17dbfcfb6a2aff..e7d249d6140d92 100644
--- a/drivers/net/ethernet/intel/ice/ice_idc_int.h
+++ b/drivers/net/ethernet/intel/ice/ice_idc_int.h
@@ -9,6 +9,6 @@
struct ice_pf;
-void ice_send_event_to_aux(struct ice_pf *pf, struct iidc_rdma_event *event);
+bool ice_send_event_to_aux(struct ice_pf *pf, struct iidc_rdma_event *event);
#endif /* !_ICE_IDC_INT_H_ */
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index d88835482d3aac..edb62606d2aae3 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -2313,11 +2313,16 @@ static void ice_service_task(struct work_struct *work)
struct iidc_rdma_event *event;
event = kzalloc_obj(*event);
- if (event) {
+ if (!event) {
+ set_bit(ICE_AUX_ERR_PENDING, pf->state);
+ } else {
set_bit(IIDC_RDMA_EVENT_CRIT_ERR, event->type);
/* report the entire OICR value to AUX driver */
swap(event->reg, pf->oicr_err_reg);
- ice_send_event_to_aux(pf, event);
+ if (!ice_send_event_to_aux(pf, event)) {
+ pf->oicr_err_reg |= event->reg;
+ set_bit(ICE_AUX_ERR_PENDING, pf->state);
+ }
kfree(event);
}
}
@@ -2336,9 +2341,12 @@ static void ice_service_task(struct work_struct *work)
struct iidc_rdma_event *event;
event = kzalloc_obj(*event);
- if (event) {
+ if (!event) {
+ set_bit(ICE_FLAG_MTU_CHANGED, pf->flags);
+ } else {
set_bit(IIDC_RDMA_EVENT_AFTER_MTU_CHANGE, event->type);
- ice_send_event_to_aux(pf, event);
+ if (!ice_send_event_to_aux(pf, event))
+ set_bit(ICE_FLAG_MTU_CHANGED, pf->flags);
kfree(event);
}
}
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* RE: [PATCH iwl-net 1/3] ice: avoid RTNL deadlock when notifying the RDMA auxiliary driver
2026-10-19 6:52 ` [PATCH iwl-net 1/3] ice: avoid RTNL deadlock when notifying the RDMA auxiliary driver Petr Oros
@ 2026-10-21 11:20 ` Loktionov, Aleksandr
2026-10-22 10:40 ` Petr Oros
0 siblings, 1 reply; 9+ messages in thread
From: Loktionov, Aleksandr @ 2026-10-21 11:20 UTC (permalink / raw)
To: Oros, Petr, netdev@vger.kernel.org
Cc: Oros, Petr, Nguyen, Anthony L, Kitszel, Przemyslaw, Andrew Lunn,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Ertman, David M, Shiraz Saleem, Leon Romanovsky, Maziarz, Kamil,
Rafal Rogalski, Schmidt, Michal, linux-rdma@vger.kernel.org,
intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Sebastian Andrzej Siewior, Clark Williams,
Steven Rostedt, Mateusz Palczewski,
linux-rt-devel@lists.linux.dev
> -----Original Message-----
> From: Petr Oros <poros@redhat.com>
> Sent: Monday, October 19, 2026 8:53 AM
> To: netdev@vger.kernel.org
> Cc: Oros, Petr <poros@redhat.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; Andrew Lunn <andrew+netdev@lunn.ch>;
> David S . Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@kernel.org>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> <pabeni@redhat.com>; Ertman, David M <david.m.ertman@intel.com>; Shiraz
> Saleem <shiraz.saleem@intel.com>; Leon Romanovsky <leon@kernel.org>;
> Maziarz, Kamil <kamil.maziarz@intel.com>; Rafal Rogalski
> <rafalx.rogalski@intel.com>; Loktionov, Aleksandr
> <aleksandr.loktionov@intel.com>; Schmidt, Michal <mschmidt@redhat.com>;
> linux-rdma@vger.kernel.org; intel-wired-lan@lists.osuosl.org; linux-
> kernel@vger.kernel.org; stable@vger.kernel.org; Sebastian Andrzej
> Siewior <bigeasy@linutronix.de>; Clark Williams <clrkwllms@kernel.org>;
> Steven Rostedt <rostedt@goodmis.org>; Mateusz Palczewski
> <mateusz.palczewski@intel.com>; linux-rt-devel@lists.linux.dev
> Subject: [PATCH iwl-net 1/3] ice: avoid RTNL deadlock when notifying the
> RDMA auxiliary driver
>
> ice_send_event_to_aux() blocks on the auxiliary device lock, and the
> dcbnl callers reach it with the RTNL lock held. The RDMA auxiliary probe
> takes the two in the opposite order, because __driver_attach() holds the
> auxiliary device lock across ib_register_device(), which needs the RTNL
> lock:
>
> systemd-udevd state:D
> really_probe <- holds device_lock(&adev->dev)
> icrdma_probe
> irdma_ib_register_device
> ib_register_device
> setup_device
> irdma_roce_port_immutable
> ib_query_port
> irdma_query_port
> ib_get_eth_speed <- blocks on rtnl_lock()
>
> lldpad state:D
> rtnetlink_rcv_msg <- holds rtnl_lock()
> dcb_doit
> dcbnl_ieee_set
> ice_dcbnl_setets
> ice_pf_dcb_cfg
> ice_send_event_to_aux <- blocks on device_lock(&adev->dev)
>
> Everything else that needs the RTNL lock piles up behind lldpad and the
> boot never completes. The probe side cannot be changed, so use
> device_trylock() and report whether the event reached the driver.
>
> IIDC_RDMA_EVENT_BEFORE_TC_CHANGE has to arrive before the traffic
> classes change, so ice_pf_dcb_cfg() refuses the request with -EBUSY
> rather than run it behind the RDMA driver's back. The critical error and
> MTU change events are sent from the service task, which consumes their
> pending bits before sending, so those are re-armed instead.
> AFTER_TC_CHANGE keeps its fire and forget behaviour, it can be neither
> refused, the hardware has already changed, nor deferred, every lock that
> would serialise a deferred delivery against the dcbnl callers forms
> another cycle.
>
> Fixes: 348048e724a0 ("ice: Implement iidc operations")
> Cc: stable@vger.kernel.org
> Signed-off-by: Petr Oros <poros@redhat.com>
> ---
> drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 9 ++++++++-
> drivers/net/ethernet/intel/ice/ice_idc.c | 20 ++++++++++++++++----
> drivers/net/ethernet/intel/ice/ice_idc_int.h | 2 +-
> drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++----
> 4 files changed, 37 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
> b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
> index 0bc6dd37568792..2022b46c990cb2 100644
> --- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
> @@ -355,8 +355,10 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct
> ice_dcbx_cfg *new_cfg, bool locked)
> struct iidc_rdma_event *event;
> int ret = ICE_DCB_NO_HW_CHG;
> struct ice_vsi *pf_vsi;
> + bool dcb_ena;
>
> curr_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg;
> + dcb_ena = test_bit(ICE_FLAG_DCB_ENA, pf->flags);
>
> /* FW does not care if change happened */
> if (!pf->hw.port_info->qos_cfg.is_sw_lldp)
> @@ -406,7 +408,12 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct
> ice_dcbx_cfg *new_cfg, bool locked)
> }
>
> set_bit(IIDC_RDMA_EVENT_BEFORE_TC_CHANGE, event->type);
> - ice_send_event_to_aux(pf, event);
> + if (!ice_send_event_to_aux(pf, event)) {
> + assign_bit(ICE_FLAG_DCB_ENA, pf->flags, dcb_ena);
> + kfree(event);
> + ret = -EBUSY;
-EBUSY doesn't match to any ICE_DCB_* constant, are you sure you tested this case?
It looks like it will be processed like ICE_DCB_NO_HW_CHG i.e. no change needed, isn't it?
> + goto free_cfg;
> + }
> kfree(event);
>
> /* avoid race conditions by holding the lock while disabling and
> diff --git a/drivers/net/ethernet/intel/ice/ice_idc.c
> b/drivers/net/ethernet/intel/ice/ice_idc.c
> index 102d63c3018b1f..7fd35ce966ea65 100644
> --- a/drivers/net/ethernet/intel/ice/ice_idc.c
> +++ b/drivers/net/ethernet/intel/ice/ice_idc.c
> @@ -34,30 +34,42 @@ ice_get_auxiliary_drv(struct iidc_rdma_core_dev_info
> *cdev)
> * ice_send_event_to_aux - send event to RDMA AUX driver
> * @pf: pointer to PF struct
> * @event: event struct
...
> kfree(event);
> }
> }
> --
> 2.56.0
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH iwl-net 1/3] ice: avoid RTNL deadlock when notifying the RDMA auxiliary driver
2026-10-21 11:20 ` Loktionov, Aleksandr
@ 2026-10-22 10:40 ` Petr Oros
0 siblings, 0 replies; 9+ messages in thread
From: Petr Oros @ 2026-10-22 10:40 UTC (permalink / raw)
To: Loktionov, Aleksandr, netdev@vger.kernel.org
Cc: Nguyen, Anthony L, Kitszel, Przemyslaw, Andrew Lunn,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Ertman, David M, Shiraz Saleem, Leon Romanovsky, Maziarz, Kamil,
Rafal Rogalski, Schmidt, Michal, linux-rdma@vger.kernel.org,
intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Sebastian Andrzej Siewior, Clark Williams,
Steven Rostedt, Mateusz Palczewski,
linux-rt-devel@lists.linux.dev
On 10/21/26 1:20 PM, Loktionov, Aleksandr wrote:
>
>
>> -----Original Message-----
>> From: Petr Oros <poros@redhat.com>
>> Sent: Monday, October 19, 2026 8:53 AM
>> To: netdev@vger.kernel.org
>> Cc: Oros, Petr <poros@redhat.com>; Nguyen, Anthony L
>> <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
>> <przemyslaw.kitszel@intel.com>; Andrew Lunn <andrew+netdev@lunn.ch>;
>> David S . Miller <davem@davemloft.net>; Eric Dumazet
>> <edumazet@kernel.org>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
>> <pabeni@redhat.com>; Ertman, David M <david.m.ertman@intel.com>; Shiraz
>> Saleem <shiraz.saleem@intel.com>; Leon Romanovsky <leon@kernel.org>;
>> Maziarz, Kamil <kamil.maziarz@intel.com>; Rafal Rogalski
>> <rafalx.rogalski@intel.com>; Loktionov, Aleksandr
>> <aleksandr.loktionov@intel.com>; Schmidt, Michal <mschmidt@redhat.com>;
>> linux-rdma@vger.kernel.org; intel-wired-lan@lists.osuosl.org; linux-
>> kernel@vger.kernel.org; stable@vger.kernel.org; Sebastian Andrzej
>> Siewior <bigeasy@linutronix.de>; Clark Williams <clrkwllms@kernel.org>;
>> Steven Rostedt <rostedt@goodmis.org>; Mateusz Palczewski
>> <mateusz.palczewski@intel.com>; linux-rt-devel@lists.linux.dev
>> Subject: [PATCH iwl-net 1/3] ice: avoid RTNL deadlock when notifying the
>> RDMA auxiliary driver
>>
>> ice_send_event_to_aux() blocks on the auxiliary device lock, and the
>> dcbnl callers reach it with the RTNL lock held. The RDMA auxiliary probe
>> takes the two in the opposite order, because __driver_attach() holds the
>> auxiliary device lock across ib_register_device(), which needs the RTNL
>> lock:
>>
>> systemd-udevd state:D
>> really_probe <- holds device_lock(&adev->dev)
>> icrdma_probe
>> irdma_ib_register_device
>> ib_register_device
>> setup_device
>> irdma_roce_port_immutable
>> ib_query_port
>> irdma_query_port
>> ib_get_eth_speed <- blocks on rtnl_lock()
>>
>> lldpad state:D
>> rtnetlink_rcv_msg <- holds rtnl_lock()
>> dcb_doit
>> dcbnl_ieee_set
>> ice_dcbnl_setets
>> ice_pf_dcb_cfg
>> ice_send_event_to_aux <- blocks on device_lock(&adev->dev)
>>
>> Everything else that needs the RTNL lock piles up behind lldpad and the
>> boot never completes. The probe side cannot be changed, so use
>> device_trylock() and report whether the event reached the driver.
>>
>> IIDC_RDMA_EVENT_BEFORE_TC_CHANGE has to arrive before the traffic
>> classes change, so ice_pf_dcb_cfg() refuses the request with -EBUSY
>> rather than run it behind the RDMA driver's back. The critical error and
>> MTU change events are sent from the service task, which consumes their
>> pending bits before sending, so those are re-armed instead.
>> AFTER_TC_CHANGE keeps its fire and forget behaviour, it can be neither
>> refused, the hardware has already changed, nor deferred, every lock that
>> would serialise a deferred delivery against the dcbnl callers forms
>> another cycle.
>>
>> Fixes: 348048e724a0 ("ice: Implement iidc operations")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Petr Oros <poros@redhat.com>
>> ---
>> drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 9 ++++++++-
>> drivers/net/ethernet/intel/ice/ice_idc.c | 20 ++++++++++++++++----
>> drivers/net/ethernet/intel/ice/ice_idc_int.h | 2 +-
>> drivers/net/ethernet/intel/ice/ice_main.c | 16 ++++++++++++----
>> 4 files changed, 37 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
>> b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
>> index 0bc6dd37568792..2022b46c990cb2 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
>> @@ -355,8 +355,10 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct
>> ice_dcbx_cfg *new_cfg, bool locked)
>> struct iidc_rdma_event *event;
>> int ret = ICE_DCB_NO_HW_CHG;
>> struct ice_vsi *pf_vsi;
>> + bool dcb_ena;
>>
>> curr_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg;
>> + dcb_ena = test_bit(ICE_FLAG_DCB_ENA, pf->flags);
>>
>> /* FW does not care if change happened */
>> if (!pf->hw.port_info->qos_cfg.is_sw_lldp)
>> @@ -406,7 +408,12 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct
>> ice_dcbx_cfg *new_cfg, bool locked)
>> }
>>
>> set_bit(IIDC_RDMA_EVENT_BEFORE_TC_CHANGE, event->type);
>> - ice_send_event_to_aux(pf, event);
>> + if (!ice_send_event_to_aux(pf, event)) {
>> + assign_bit(ICE_FLAG_DCB_ENA, pf->flags, dcb_ena);
>> + kfree(event);
>> + ret = -EBUSY;
> -EBUSY doesn't match to any ICE_DCB_* constant, are you sure you tested this case?
> It looks like it will be processed like ICE_DCB_NO_HW_CHG i.e. no change needed, isn't it?
The negative return takes the same path as the existing -EBUSY for the
custom Tx scheduler. ice_dcbnl_setets() and setpfc() pass it to dcbnl
unchanged, only ICE_DCB_NO_HW_CHG is mapped to zero. setapp() and
cee_set_all() mask every error, that is pre-existing and also hides
-ENOMEM and the AQ errors. I have noted this in the v2 message.
>
>
>> + goto free_cfg;
>> + }
>> kfree(event);
>>
>> /* avoid race conditions by holding the lock while disabling and
>> diff --git a/drivers/net/ethernet/intel/ice/ice_idc.c
>> b/drivers/net/ethernet/intel/ice/ice_idc.c
>> index 102d63c3018b1f..7fd35ce966ea65 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_idc.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_idc.c
>> @@ -34,30 +34,42 @@ ice_get_auxiliary_drv(struct iidc_rdma_core_dev_info
>> *cdev)
>> * ice_send_event_to_aux - send event to RDMA AUX driver
>> * @pf: pointer to PF struct
>> * @event: event struct
>
> ...
>
>> kfree(event);
>> }
>> }
>> --
>> 2.56.0
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH iwl-net 2/3] ice: do not block on the aux device lock in ethtool set_channels
2026-10-19 6:52 [PATCH iwl-net 0/3] ice: fix RTNL vs auxiliary device lock inversion Petr Oros
2026-10-19 6:52 ` [PATCH iwl-net 1/3] ice: avoid RTNL deadlock when notifying the RDMA auxiliary driver Petr Oros
@ 2026-10-19 6:53 ` Petr Oros
2026-10-19 6:53 ` [PATCH iwl-net 3/3] ice: do not block on the aux device lock in ndo_setup_tc Petr Oros
2026-10-20 10:06 ` [PATCH iwl-net 0/3] ice: fix RTNL vs auxiliary device lock inversion Przemek Kitszel
3 siblings, 0 replies; 9+ messages in thread
From: Petr Oros @ 2026-10-19 6:53 UTC (permalink / raw)
To: netdev
Cc: Petr Oros, Tony Nguyen, Przemek Kitszel, Andrew Lunn,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Dave Ertman, Shiraz Saleem, Leon Romanovsky, Kamil Maziarz,
Rafal Rogalski, Aleksandr Loktionov, Michal Schmidt, linux-rdma,
intel-wired-lan, linux-kernel, stable, Sebastian Andrzej Siewior,
Clark Williams, Steven Rostedt, Mateusz Palczewski,
linux-rt-devel
ice_set_channels() takes the auxiliary device lock to test whether the
RDMA driver is bound, and ethtool ops run with the RTNL lock held. This
is the same inversion against the RDMA auxiliary probe as the one fixed
in ice_send_event_to_aux(), reached through a different caller.
Use device_trylock() and report the device as busy when it fails. The
existing diagnostic is not reused, a contended lock does not mean the
RDMA driver is bound. It is a netdev_dbg(), the condition is transient
and userspace already learns about it from -EBUSY.
Fixes: a6a0974aae42 ("ice: Prevent set_channel from changing queues while RDMA active")
Cc: stable@vger.kernel.org
Signed-off-by: Petr Oros <poros@redhat.com>
---
drivers/net/ethernet/intel/ice/ice_ethtool.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index bf9a821c543b7f..f754ffe03285e2 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -3944,7 +3944,11 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)
if (pf->cdev_info && pf->cdev_info->adev) {
mutex_lock(&pf->adev_mutex);
- device_lock(&pf->cdev_info->adev->dev);
+ if (!device_trylock(&pf->cdev_info->adev->dev)) {
+ mutex_unlock(&pf->adev_mutex);
+ netdev_dbg(dev, "RDMA auxiliary device is busy, try again\n");
+ return -EBUSY;
+ }
locked = true;
if (pf->cdev_info->adev->dev.driver) {
netdev_err(dev, "Cannot change channels when RDMA is active\n");
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH iwl-net 3/3] ice: do not block on the aux device lock in ndo_setup_tc
2026-10-19 6:52 [PATCH iwl-net 0/3] ice: fix RTNL vs auxiliary device lock inversion Petr Oros
2026-10-19 6:52 ` [PATCH iwl-net 1/3] ice: avoid RTNL deadlock when notifying the RDMA auxiliary driver Petr Oros
2026-10-19 6:53 ` [PATCH iwl-net 2/3] ice: do not block on the aux device lock in ethtool set_channels Petr Oros
@ 2026-10-19 6:53 ` Petr Oros
2026-10-21 11:22 ` Loktionov, Aleksandr
2026-10-20 10:06 ` [PATCH iwl-net 0/3] ice: fix RTNL vs auxiliary device lock inversion Przemek Kitszel
3 siblings, 1 reply; 9+ messages in thread
From: Petr Oros @ 2026-10-19 6:53 UTC (permalink / raw)
To: netdev
Cc: Petr Oros, Tony Nguyen, Przemek Kitszel, Andrew Lunn,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Dave Ertman, Shiraz Saleem, Leon Romanovsky, Kamil Maziarz,
Rafal Rogalski, Aleksandr Loktionov, Michal Schmidt, linux-rdma,
intel-wired-lan, linux-kernel, stable, Sebastian Andrzej Siewior,
Clark Williams, Steven Rostedt, Mateusz Palczewski,
linux-rt-devel
The TC_SETUP_QDISC_MQPRIO path of ice_setup_tc() takes the auxiliary
device lock to test whether the RDMA driver is bound, and ndo_setup_tc()
runs with the RTNL lock held. This closes the same cycle against the
RDMA auxiliary probe as the two preceding patches.
Use device_trylock() and report the device as busy when it fails, with
a distinct message for the same reason as in the previous patch.
Fixes: 4b31fd4d77ff ("ice: Fix RDMA VSI removal during queue rebuild")
Cc: stable@vger.kernel.org
Signed-off-by: Petr Oros <poros@redhat.com>
---
drivers/net/ethernet/intel/ice/ice_main.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index edb62606d2aae3..7b251136149615 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -9448,7 +9448,11 @@ ice_setup_tc(struct net_device *netdev, enum tc_setup_type type,
cdev = pf->cdev_info;
if (cdev && cdev->adev) {
mutex_lock(&pf->adev_mutex);
- device_lock(&cdev->adev->dev);
+ if (!device_trylock(&cdev->adev->dev)) {
+ mutex_unlock(&pf->adev_mutex);
+ netdev_dbg(netdev, "RDMA auxiliary device is busy, try again\n");
+ return -EBUSY;
+ }
locked = true;
if (cdev->adev->dev.driver) {
netdev_err(netdev, "Cannot change qdisc when RDMA is active\n");
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* RE: [PATCH iwl-net 3/3] ice: do not block on the aux device lock in ndo_setup_tc
2026-10-19 6:53 ` [PATCH iwl-net 3/3] ice: do not block on the aux device lock in ndo_setup_tc Petr Oros
@ 2026-10-21 11:22 ` Loktionov, Aleksandr
2026-10-22 10:54 ` Petr Oros
0 siblings, 1 reply; 9+ messages in thread
From: Loktionov, Aleksandr @ 2026-10-21 11:22 UTC (permalink / raw)
To: Oros, Petr, netdev@vger.kernel.org
Cc: Oros, Petr, Nguyen, Anthony L, Kitszel, Przemyslaw, Andrew Lunn,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Ertman, David M, Shiraz Saleem, Leon Romanovsky, Maziarz, Kamil,
Rafal Rogalski, Schmidt, Michal, linux-rdma@vger.kernel.org,
intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Sebastian Andrzej Siewior, Clark Williams,
Steven Rostedt, Mateusz Palczewski,
linux-rt-devel@lists.linux.dev
> -----Original Message-----
> From: Petr Oros <poros@redhat.com>
> Sent: Monday, October 19, 2026 8:53 AM
> To: netdev@vger.kernel.org
> Cc: Oros, Petr <poros@redhat.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; Andrew Lunn <andrew+netdev@lunn.ch>;
> David S . Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@kernel.org>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> <pabeni@redhat.com>; Ertman, David M <david.m.ertman@intel.com>; Shiraz
> Saleem <shiraz.saleem@intel.com>; Leon Romanovsky <leon@kernel.org>;
> Maziarz, Kamil <kamil.maziarz@intel.com>; Rafal Rogalski
> <rafalx.rogalski@intel.com>; Loktionov, Aleksandr
> <aleksandr.loktionov@intel.com>; Schmidt, Michal <mschmidt@redhat.com>;
> linux-rdma@vger.kernel.org; intel-wired-lan@lists.osuosl.org; linux-
> kernel@vger.kernel.org; stable@vger.kernel.org; Sebastian Andrzej
> Siewior <bigeasy@linutronix.de>; Clark Williams <clrkwllms@kernel.org>;
> Steven Rostedt <rostedt@goodmis.org>; Mateusz Palczewski
> <mateusz.palczewski@intel.com>; linux-rt-devel@lists.linux.dev
> Subject: [PATCH iwl-net 3/3] ice: do not block on the aux device lock in
> ndo_setup_tc
>
> The TC_SETUP_QDISC_MQPRIO path of ice_setup_tc() takes the auxiliary
> device lock to test whether the RDMA driver is bound, and ndo_setup_tc()
> runs with the RTNL lock held. This closes the same cycle against the
> RDMA auxiliary probe as the two preceding patches.
>
> Use device_trylock() and report the device as busy when it fails, with a
> distinct message for the same reason as in the previous patch.
>
> Fixes: 4b31fd4d77ff ("ice: Fix RDMA VSI removal during queue rebuild")
> Cc: stable@vger.kernel.org
> Signed-off-by: Petr Oros <poros@redhat.com>
> ---
> drivers/net/ethernet/intel/ice/ice_main.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
> b/drivers/net/ethernet/intel/ice/ice_main.c
> index edb62606d2aae3..7b251136149615 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -9448,7 +9448,11 @@ ice_setup_tc(struct net_device *netdev, enum
> tc_setup_type type,
> cdev = pf->cdev_info;
> if (cdev && cdev->adev) {
> mutex_lock(&pf->adev_mutex);
> - device_lock(&cdev->adev->dev);
> + if (!device_trylock(&cdev->adev->dev)) {
> + mutex_unlock(&pf->adev_mutex);
> + netdev_dbg(netdev, "RDMA auxiliary device is
> busy, try again\n");
> + return -EBUSY;
You return error here, but it looks like being silently dropped in mqprio_disable_offload() isn't it ?
> + }
> locked = true;
> if (cdev->adev->dev.driver) {
> netdev_err(netdev, "Cannot change qdisc when
> RDMA is active\n");
> --
> 2.56.0
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH iwl-net 3/3] ice: do not block on the aux device lock in ndo_setup_tc
2026-10-21 11:22 ` Loktionov, Aleksandr
@ 2026-10-22 10:54 ` Petr Oros
0 siblings, 0 replies; 9+ messages in thread
From: Petr Oros @ 2026-10-22 10:54 UTC (permalink / raw)
To: Loktionov, Aleksandr, netdev@vger.kernel.org
Cc: Nguyen, Anthony L, Kitszel, Przemyslaw, Andrew Lunn,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Ertman, David M, Shiraz Saleem, Leon Romanovsky, Maziarz, Kamil,
Rafal Rogalski, Schmidt, Michal, linux-rdma@vger.kernel.org,
intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Sebastian Andrzej Siewior, Clark Williams,
Steven Rostedt, Mateusz Palczewski,
linux-rt-devel@lists.linux.dev
On 10/21/26 1:22 PM, Loktionov, Aleksandr wrote:
>
>
>> -----Original Message-----
>> From: Petr Oros <poros@redhat.com>
>> Sent: Monday, October 19, 2026 8:53 AM
>> To: netdev@vger.kernel.org
>> Cc: Oros, Petr <poros@redhat.com>; Nguyen, Anthony L
>> <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
>> <przemyslaw.kitszel@intel.com>; Andrew Lunn <andrew+netdev@lunn.ch>;
>> David S . Miller <davem@davemloft.net>; Eric Dumazet
>> <edumazet@kernel.org>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
>> <pabeni@redhat.com>; Ertman, David M <david.m.ertman@intel.com>; Shiraz
>> Saleem <shiraz.saleem@intel.com>; Leon Romanovsky <leon@kernel.org>;
>> Maziarz, Kamil <kamil.maziarz@intel.com>; Rafal Rogalski
>> <rafalx.rogalski@intel.com>; Loktionov, Aleksandr
>> <aleksandr.loktionov@intel.com>; Schmidt, Michal <mschmidt@redhat.com>;
>> linux-rdma@vger.kernel.org; intel-wired-lan@lists.osuosl.org; linux-
>> kernel@vger.kernel.org; stable@vger.kernel.org; Sebastian Andrzej
>> Siewior <bigeasy@linutronix.de>; Clark Williams <clrkwllms@kernel.org>;
>> Steven Rostedt <rostedt@goodmis.org>; Mateusz Palczewski
>> <mateusz.palczewski@intel.com>; linux-rt-devel@lists.linux.dev
>> Subject: [PATCH iwl-net 3/3] ice: do not block on the aux device lock in
>> ndo_setup_tc
>>
>> The TC_SETUP_QDISC_MQPRIO path of ice_setup_tc() takes the auxiliary
>> device lock to test whether the RDMA driver is bound, and ndo_setup_tc()
>> runs with the RTNL lock held. This closes the same cycle against the
>> RDMA auxiliary probe as the two preceding patches.
>>
>> Use device_trylock() and report the device as busy when it fails, with a
>> distinct message for the same reason as in the previous patch.
>>
>> Fixes: 4b31fd4d77ff ("ice: Fix RDMA VSI removal during queue rebuild")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Petr Oros <poros@redhat.com>
>> ---
>> drivers/net/ethernet/intel/ice/ice_main.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
>> b/drivers/net/ethernet/intel/ice/ice_main.c
>> index edb62606d2aae3..7b251136149615 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_main.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
>> @@ -9448,7 +9448,11 @@ ice_setup_tc(struct net_device *netdev, enum
>> tc_setup_type type,
>> cdev = pf->cdev_info;
>> if (cdev && cdev->adev) {
>> mutex_lock(&pf->adev_mutex);
>> - device_lock(&cdev->adev->dev);
>> + if (!device_trylock(&cdev->adev->dev)) {
>> + mutex_unlock(&pf->adev_mutex);
>> + netdev_dbg(netdev, "RDMA auxiliary device is
>> busy, try again\n");
>> + return -EBUSY;
> You return error here, but it looks like being silently dropped in mqprio_disable_offload() isn't it ?
Yes, mqprio_disable_offload() ignores it, the same as it ignores the
existing -EBUSY for a bound RDMA driver. Blocking there brings the
deadlock back and skipping the lock races with the probe, so v2 keeps
the refusal and warns about it instead of netdev_dbg().
>
>> + }
>> locked = true;
>> if (cdev->adev->dev.driver) {
>> netdev_err(netdev, "Cannot change qdisc when
>> RDMA is active\n");
>> --
>> 2.56.0
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH iwl-net 0/3] ice: fix RTNL vs auxiliary device lock inversion
2026-10-19 6:52 [PATCH iwl-net 0/3] ice: fix RTNL vs auxiliary device lock inversion Petr Oros
` (2 preceding siblings ...)
2026-10-19 6:53 ` [PATCH iwl-net 3/3] ice: do not block on the aux device lock in ndo_setup_tc Petr Oros
@ 2026-10-20 10:06 ` Przemek Kitszel
3 siblings, 0 replies; 9+ messages in thread
From: Przemek Kitszel @ 2026-10-20 10:06 UTC (permalink / raw)
To: Petr Oros, netdev
Cc: Tony Nguyen, Andrew Lunn, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Dave Ertman, Leon Romanovsky,
Kamil Maziarz, Rafal Rogalski, Aleksandr Loktionov,
Michal Schmidt, linux-rdma, intel-wired-lan, linux-kernel,
Sebastian Andrzej Siewior, Clark Williams, Steven Rostedt,
linux-rt-devel
> A window entry is a contended device_trylock(), that is, the exact
> moment really_probe() holds the auxiliary device lock and waits for the
> RTNL lock, so each one is an occasion that used to close the cycle.
> Without the series the console shows both halves and the box only
> returns through hung_task_panic. 25 reboots on the patched kernel were
> clean.
>
> Petr Oros (3):
> ice: avoid RTNL deadlock when notifying the RDMA auxiliary driver
> ice: do not block on the aux device lock in ethtool set_channels
> ice: do not block on the aux device lock in ndo_setup_tc
>
> drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 9 +++++++-
> drivers/net/ethernet/intel/ice/ice_ethtool.c | 6 +++++-
> drivers/net/ethernet/intel/ice/ice_idc.c | 20 ++++++++++++++----
> drivers/net/ethernet/intel/ice/ice_idc_int.h | 2 +-
> drivers/net/ethernet/intel/ice/ice_main.c | 22 +++++++++++++++-----
> 5 files changed, 47 insertions(+), 12 deletions(-)
>
trylock is clearly an antipattern, but we don't have anything better,
especially for a -net material
side note: we have resolved the same issue via rtnl_unlock()&relock()
in OOT (to be published within days), which is even worse anti-pattern
Would be best to have proper API as -next thing, glad to hear your
support on that!
side note2: I have a few fixes around the thing you touches, but no
conflicts so far, will CC you
^ permalink raw reply [flat|nested] 9+ messages in thread