* [PATCH net] mlxsw: minimal: Fix deadlock in ports creation
@ 2022-08-11 9:57 Petr Machata
2022-08-11 11:44 ` Petr Machata
2022-08-11 16:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Petr Machata @ 2022-08-11 9:57 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev
Cc: linux-kernel, Petr Machata, Vadim Pasternak, Ido Schimmel
From: Vadim Pasternak <vadimp@nvidia.com>
Drop devl_lock() / devl_unlock() from ports creation and removal flows
since the devlink instance lock is now taken by mlxsw_core.
Fixes: 72a4c8c94efa ("mlxsw: convert driver to use unlocked devlink API during init/fini")
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlxsw/minimal.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
index d9bf584234a6..bb1cd4bae82e 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
@@ -328,7 +328,6 @@ static void mlxsw_m_port_module_unmap(struct mlxsw_m *mlxsw_m, u8 module)
static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
{
unsigned int max_ports = mlxsw_core_max_ports(mlxsw_m->core);
- struct devlink *devlink = priv_to_devlink(mlxsw_m->core);
u8 last_module = max_ports;
int i;
int err;
@@ -357,7 +356,6 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
}
/* Create port objects for each valid entry */
- devl_lock(devlink);
for (i = 0; i < mlxsw_m->max_ports; i++) {
if (mlxsw_m->module_to_port[i] > 0) {
err = mlxsw_m_port_create(mlxsw_m,
@@ -367,7 +365,6 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
goto err_module_to_port_create;
}
}
- devl_unlock(devlink);
return 0;
@@ -377,7 +374,6 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
mlxsw_m_port_remove(mlxsw_m,
mlxsw_m->module_to_port[i]);
}
- devl_unlock(devlink);
i = max_ports;
err_module_to_port_map:
for (i--; i > 0; i--)
@@ -390,10 +386,8 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
static void mlxsw_m_ports_remove(struct mlxsw_m *mlxsw_m)
{
- struct devlink *devlink = priv_to_devlink(mlxsw_m->core);
int i;
- devl_lock(devlink);
for (i = 0; i < mlxsw_m->max_ports; i++) {
if (mlxsw_m->module_to_port[i] > 0) {
mlxsw_m_port_remove(mlxsw_m,
@@ -401,7 +395,6 @@ static void mlxsw_m_ports_remove(struct mlxsw_m *mlxsw_m)
mlxsw_m_port_module_unmap(mlxsw_m, i);
}
}
- devl_unlock(devlink);
kfree(mlxsw_m->module_to_port);
kfree(mlxsw_m->ports);
--
2.35.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] mlxsw: minimal: Fix deadlock in ports creation
2022-08-11 9:57 [PATCH net] mlxsw: minimal: Fix deadlock in ports creation Petr Machata
@ 2022-08-11 11:44 ` Petr Machata
2022-08-11 11:59 ` Jiri Pirko
2022-08-11 16:10 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Petr Machata @ 2022-08-11 11:44 UTC (permalink / raw)
To: Petr Machata
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev, linux-kernel, Vadim Pasternak, Ido Schimmel, Jiri Pirko
CC'ing Jiri, which I forgot to do.
Petr Machata <petrm@nvidia.com> writes:
> From: Vadim Pasternak <vadimp@nvidia.com>
>
> Drop devl_lock() / devl_unlock() from ports creation and removal flows
> since the devlink instance lock is now taken by mlxsw_core.
>
> Fixes: 72a4c8c94efa ("mlxsw: convert driver to use unlocked devlink API during init/fini")
> Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> Signed-off-by: Petr Machata <petrm@nvidia.com>
> ---
> drivers/net/ethernet/mellanox/mlxsw/minimal.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
> index d9bf584234a6..bb1cd4bae82e 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
> @@ -328,7 +328,6 @@ static void mlxsw_m_port_module_unmap(struct mlxsw_m *mlxsw_m, u8 module)
> static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
> {
> unsigned int max_ports = mlxsw_core_max_ports(mlxsw_m->core);
> - struct devlink *devlink = priv_to_devlink(mlxsw_m->core);
> u8 last_module = max_ports;
> int i;
> int err;
> @@ -357,7 +356,6 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
> }
>
> /* Create port objects for each valid entry */
> - devl_lock(devlink);
> for (i = 0; i < mlxsw_m->max_ports; i++) {
> if (mlxsw_m->module_to_port[i] > 0) {
> err = mlxsw_m_port_create(mlxsw_m,
> @@ -367,7 +365,6 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
> goto err_module_to_port_create;
> }
> }
> - devl_unlock(devlink);
>
> return 0;
>
> @@ -377,7 +374,6 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
> mlxsw_m_port_remove(mlxsw_m,
> mlxsw_m->module_to_port[i]);
> }
> - devl_unlock(devlink);
> i = max_ports;
> err_module_to_port_map:
> for (i--; i > 0; i--)
> @@ -390,10 +386,8 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
>
> static void mlxsw_m_ports_remove(struct mlxsw_m *mlxsw_m)
> {
> - struct devlink *devlink = priv_to_devlink(mlxsw_m->core);
> int i;
>
> - devl_lock(devlink);
> for (i = 0; i < mlxsw_m->max_ports; i++) {
> if (mlxsw_m->module_to_port[i] > 0) {
> mlxsw_m_port_remove(mlxsw_m,
> @@ -401,7 +395,6 @@ static void mlxsw_m_ports_remove(struct mlxsw_m *mlxsw_m)
> mlxsw_m_port_module_unmap(mlxsw_m, i);
> }
> }
> - devl_unlock(devlink);
>
> kfree(mlxsw_m->module_to_port);
> kfree(mlxsw_m->ports);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] mlxsw: minimal: Fix deadlock in ports creation
2022-08-11 11:44 ` Petr Machata
@ 2022-08-11 11:59 ` Jiri Pirko
0 siblings, 0 replies; 4+ messages in thread
From: Jiri Pirko @ 2022-08-11 11:59 UTC (permalink / raw)
To: Petr Machata
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev, linux-kernel, Vadim Pasternak, Ido Schimmel
Thu, Aug 11, 2022 at 01:44:17PM CEST, petrm@nvidia.com wrote:
>CC'ing Jiri, which I forgot to do.
Oups, I forgot the minimal driver. Sorry about that.
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] mlxsw: minimal: Fix deadlock in ports creation
2022-08-11 9:57 [PATCH net] mlxsw: minimal: Fix deadlock in ports creation Petr Machata
2022-08-11 11:44 ` Petr Machata
@ 2022-08-11 16:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-08-11 16:10 UTC (permalink / raw)
To: Petr Machata
Cc: davem, edumazet, kuba, pabeni, netdev, linux-kernel, vadimp,
idosch
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 11 Aug 2022 11:57:36 +0200 you wrote:
> From: Vadim Pasternak <vadimp@nvidia.com>
>
> Drop devl_lock() / devl_unlock() from ports creation and removal flows
> since the devlink instance lock is now taken by mlxsw_core.
>
> Fixes: 72a4c8c94efa ("mlxsw: convert driver to use unlocked devlink API during init/fini")
> Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> Signed-off-by: Petr Machata <petrm@nvidia.com>
>
> [...]
Here is the summary with links:
- [net] mlxsw: minimal: Fix deadlock in ports creation
https://git.kernel.org/netdev/net/c/4f98cb0408b0
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] 4+ messages in thread
end of thread, other threads:[~2022-08-11 16:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11 9:57 [PATCH net] mlxsw: minimal: Fix deadlock in ports creation Petr Machata
2022-08-11 11:44 ` Petr Machata
2022-08-11 11:59 ` Jiri Pirko
2022-08-11 16:10 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.