* [PATCH net] eth: alx: take rtnl_lock on resume
@ 2022-09-28 18:12 Jakub Kicinski
2022-09-29 7:48 ` Niels Dossche
2022-09-30 2:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2022-09-28 18:12 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, Jakub Kicinski, Zbynek Michl,
chris.snook, dossche.niels, johannes
Zbynek reports that alx trips an rtnl assertion on resume:
RTNL: assertion failed at net/core/dev.c (2891)
RIP: 0010:netif_set_real_num_tx_queues+0x1ac/0x1c0
Call Trace:
<TASK>
__alx_open+0x230/0x570 [alx]
alx_resume+0x54/0x80 [alx]
? pci_legacy_resume+0x80/0x80
dpm_run_callback+0x4a/0x150
device_resume+0x8b/0x190
async_resume+0x19/0x30
async_run_entry_fn+0x30/0x130
process_one_work+0x1e5/0x3b0
indeed the driver does not hold rtnl_lock during its internal close
and re-open functions during suspend/resume. Note that this is not
a huge bug as the driver implements its own locking, and does not
implement changing the number of queues, but we need to silence
the splat.
Fixes: 4a5fe57e7751 ("alx: use fine-grained locking instead of RTNL")
Reported-and-tested-by: Zbynek Michl <zbynek.michl@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: chris.snook@gmail.com
CC: dossche.niels@gmail.com
CC: johannes@sipsolutions.net
---
drivers/net/ethernet/atheros/alx/main.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
index a89b93cb4e26..d5939586c82e 100644
--- a/drivers/net/ethernet/atheros/alx/main.c
+++ b/drivers/net/ethernet/atheros/alx/main.c
@@ -1912,11 +1912,14 @@ static int alx_suspend(struct device *dev)
if (!netif_running(alx->dev))
return 0;
+
+ rtnl_lock();
netif_device_detach(alx->dev);
mutex_lock(&alx->mtx);
__alx_stop(alx);
mutex_unlock(&alx->mtx);
+ rtnl_unlock();
return 0;
}
@@ -1927,6 +1930,7 @@ static int alx_resume(struct device *dev)
struct alx_hw *hw = &alx->hw;
int err;
+ rtnl_lock();
mutex_lock(&alx->mtx);
alx_reset_phy(hw);
@@ -1943,6 +1947,7 @@ static int alx_resume(struct device *dev)
unlock:
mutex_unlock(&alx->mtx);
+ rtnl_unlock();
return err;
}
--
2.37.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] eth: alx: take rtnl_lock on resume
2022-09-28 18:12 [PATCH net] eth: alx: take rtnl_lock on resume Jakub Kicinski
@ 2022-09-29 7:48 ` Niels Dossche
2022-09-30 2:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Niels Dossche @ 2022-09-29 7:48 UTC (permalink / raw)
To: Jakub Kicinski, davem
Cc: netdev, edumazet, pabeni, Zbynek Michl, chris.snook, johannes
On 9/28/22 20:12, Jakub Kicinski wrote:
> Zbynek reports that alx trips an rtnl assertion on resume:
>
> RTNL: assertion failed at net/core/dev.c (2891)
> RIP: 0010:netif_set_real_num_tx_queues+0x1ac/0x1c0
> Call Trace:
> <TASK>
> __alx_open+0x230/0x570 [alx]
> alx_resume+0x54/0x80 [alx]
> ? pci_legacy_resume+0x80/0x80
> dpm_run_callback+0x4a/0x150
> device_resume+0x8b/0x190
> async_resume+0x19/0x30
> async_run_entry_fn+0x30/0x130
> process_one_work+0x1e5/0x3b0
>
> indeed the driver does not hold rtnl_lock during its internal close
> and re-open functions during suspend/resume. Note that this is not
> a huge bug as the driver implements its own locking, and does not
> implement changing the number of queues, but we need to silence
> the splat.
>
> Fixes: 4a5fe57e7751 ("alx: use fine-grained locking instead of RTNL")
> Reported-and-tested-by: Zbynek Michl <zbynek.michl@gmail.com>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: chris.snook@gmail.com
> CC: dossche.niels@gmail.com
> CC: johannes@sipsolutions.net
> ---
> drivers/net/ethernet/atheros/alx/main.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
> index a89b93cb4e26..d5939586c82e 100644
> --- a/drivers/net/ethernet/atheros/alx/main.c
> +++ b/drivers/net/ethernet/atheros/alx/main.c
> @@ -1912,11 +1912,14 @@ static int alx_suspend(struct device *dev)
>
> if (!netif_running(alx->dev))
> return 0;
> +
> + rtnl_lock();
> netif_device_detach(alx->dev);
>
> mutex_lock(&alx->mtx);
> __alx_stop(alx);
> mutex_unlock(&alx->mtx);
> + rtnl_unlock();
>
> return 0;
> }
> @@ -1927,6 +1930,7 @@ static int alx_resume(struct device *dev)
> struct alx_hw *hw = &alx->hw;
> int err;
>
> + rtnl_lock();
> mutex_lock(&alx->mtx);
> alx_reset_phy(hw);
>
> @@ -1943,6 +1947,7 @@ static int alx_resume(struct device *dev)
>
> unlock:
> mutex_unlock(&alx->mtx);
> + rtnl_unlock();
> return err;
> }
>
Reviewed-by: Niels Dossche <dossche.niels@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] eth: alx: take rtnl_lock on resume
2022-09-28 18:12 [PATCH net] eth: alx: take rtnl_lock on resume Jakub Kicinski
2022-09-29 7:48 ` Niels Dossche
@ 2022-09-30 2:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-09-30 2:40 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, zbynek.michl, chris.snook,
dossche.niels, johannes
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 28 Sep 2022 11:12:36 -0700 you wrote:
> Zbynek reports that alx trips an rtnl assertion on resume:
>
> RTNL: assertion failed at net/core/dev.c (2891)
> RIP: 0010:netif_set_real_num_tx_queues+0x1ac/0x1c0
> Call Trace:
> <TASK>
> __alx_open+0x230/0x570 [alx]
> alx_resume+0x54/0x80 [alx]
> ? pci_legacy_resume+0x80/0x80
> dpm_run_callback+0x4a/0x150
> device_resume+0x8b/0x190
> async_resume+0x19/0x30
> async_run_entry_fn+0x30/0x130
> process_one_work+0x1e5/0x3b0
>
> [...]
Here is the summary with links:
- [net] eth: alx: take rtnl_lock on resume
https://git.kernel.org/netdev/net/c/6ad1c94e1e7e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-30 2:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 18:12 [PATCH net] eth: alx: take rtnl_lock on resume Jakub Kicinski
2022-09-29 7:48 ` Niels Dossche
2022-09-30 2:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).