* [PATCH net v2] net: xdp: don't call notifiers during driver init
@ 2023-03-16 22:02 Jakub Kicinski
2023-03-17 4:40 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Kicinski @ 2023-03-16 22:02 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, Jakub Kicinski, ast, daniel, hawk,
john.fastabend, lorenzo, tariqt, bpf
Drivers will commonly perform feature setting during init, if they use
the xdp_set_features_flag() helper they'll likely run into an ASSERT_RTNL()
inside call_netdevice_notifiers_info().
Don't call the notifier until the device is actually registered.
Nothing should be tracking the device until its registered and
after its unregistration has started.
Fixes: 4d5ab0ad964d ("net/mlx5e: take into account device reconfiguration for xdp_features flag")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
v2: only call for REGISTERED devices, not dead ones
v1: https://lore.kernel.org/all/20230316002903.492497-1-kuba@kernel.org/
CC: ast@kernel.org
CC: daniel@iogearbox.net
CC: hawk@kernel.org
CC: john.fastabend@gmail.com
CC: lorenzo@kernel.org
CC: tariqt@nvidia.com
CC: bpf@vger.kernel.org
---
net/core/xdp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/xdp.c b/net/core/xdp.c
index 87e654b7d06c..b5737e47ec41 100644
--- a/net/core/xdp.c
+++ b/net/core/xdp.c
@@ -781,7 +781,9 @@ void xdp_set_features_flag(struct net_device *dev, xdp_features_t val)
return;
dev->xdp_features = val;
- call_netdevice_notifiers(NETDEV_XDP_FEAT_CHANGE, dev);
+
+ if (dev->reg_state == NETREG_REGISTERED)
+ call_netdevice_notifiers(NETDEV_XDP_FEAT_CHANGE, dev);
}
EXPORT_SYMBOL_GPL(xdp_set_features_flag);
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net v2] net: xdp: don't call notifiers during driver init
2023-03-16 22:02 [PATCH net v2] net: xdp: don't call notifiers during driver init Jakub Kicinski
@ 2023-03-17 4:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-17 4:40 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, ast, daniel, hawk,
john.fastabend, lorenzo, tariqt, bpf
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 16 Mar 2023 15:02:34 -0700 you wrote:
> Drivers will commonly perform feature setting during init, if they use
> the xdp_set_features_flag() helper they'll likely run into an ASSERT_RTNL()
> inside call_netdevice_notifiers_info().
>
> Don't call the notifier until the device is actually registered.
> Nothing should be tracking the device until its registered and
> after its unregistration has started.
>
> [...]
Here is the summary with links:
- [net,v2] net: xdp: don't call notifiers during driver init
https://git.kernel.org/netdev/net/c/769639c1fe8a
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] 2+ messages in thread
end of thread, other threads:[~2023-03-17 4:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-16 22:02 [PATCH net v2] net: xdp: don't call notifiers during driver init Jakub Kicinski
2023-03-17 4: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).