From: Daniel Zahka <daniel.zahka@gmail.com>
To: Wei Wang <weibunny.kernel@gmail.com>,
netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
David Wei <dw@davidwei.uk>, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Simon Horman <horms@kernel.org>
Cc: Wei Wang <weibunny@fb.com>
Subject: Re: [PATCH v9 net-next 3/5] psp: add a new netdev event for dev unregister
Date: Tue, 31 Mar 2026 09:30:46 -0400 [thread overview]
Message-ID: <1d013236-e945-46fc-8acb-c7ab9ac32a1f@gmail.com> (raw)
In-Reply-To: <20260330223143.2394706-4-weibunny.kernel@gmail.com>
On 3/30/26 6:31 PM, Wei Wang wrote:
> +static bool psp_notifier_registered;
> +
> +/**
> + * psp_attach_netdev_notifier() - register netdev notifier on first use
> + *
> + * Register the netdevice notifier when the first device association
> + * is created. In many installations no associations will be created and
> + * the notifier won't be needed.
> + *
> + * Must be called without psd->lock held, due to lock ordering:
> + * rtnl_lock -> psd->lock (the notifier callback runs under rtnl_lock
> + * and takes psd->lock).
> + */
> +void psp_attach_netdev_notifier(void)
> +{
> + if (READ_ONCE(psp_notifier_registered))
> + return;
> +
> + mutex_lock(&psp_devs_lock);
> + if (!psp_notifier_registered) {
> + if (!register_netdevice_notifier(&psp_netdev_notifier))
> + WRITE_ONCE(psp_notifier_registered, true);
> + }
> + mutex_unlock(&psp_devs_lock);
> +}
...
>
> +int psp_device_get_locked_dev_assoc(const struct genl_split_ops *ops,
> + struct sk_buff *skb, struct genl_info *info)
> +{
> + psp_attach_netdev_notifier();
> +
> + return __psp_device_get_locked(ops, skb, info, false);
> +}
From an AI review, but seems plausible to me:
psp_device_get_locked_dev_assoc() will proceed even in the path where
register_netdevice_notifier() and psp_notifier_registered stays false.
next prev parent reply other threads:[~2026-03-31 13:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 22:31 [PATCH v9 net-next 0/5] psp: Add support for dev-assoc/disassoc Wei Wang
2026-03-30 22:31 ` [PATCH v9 net-next 1/5] psp: add admin/non-admin version of psp_device_get_locked Wei Wang
2026-03-30 22:31 ` [PATCH v9 net-next 2/5] psp: add new netlink cmd for dev-assoc and dev-disassoc Wei Wang
2026-03-31 13:03 ` Daniel Zahka
2026-03-31 21:48 ` Wei Wang
2026-03-31 23:43 ` kernel test robot
2026-03-30 22:31 ` [PATCH v9 net-next 3/5] psp: add a new netdev event for dev unregister Wei Wang
2026-03-31 13:30 ` Daniel Zahka [this message]
2026-03-31 21:51 ` Wei Wang
2026-04-01 13:02 ` Daniel Zahka
2026-04-01 21:39 ` Wei Wang
2026-03-30 22:31 ` [PATCH v9 net-next 4/5] selftests/net: Add bpf skb forwarding program Wei Wang
2026-03-30 22:31 ` [PATCH v9 net-next 5/5] selftest/net: psp: Add test for dev-assoc/disassoc Wei Wang
2026-03-31 14:04 ` Daniel Zahka
2026-03-31 22:09 ` Wei Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d013236-e945-46fc-8acb-c7ab9ac32a1f@gmail.com \
--to=daniel.zahka@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dw@davidwei.uk \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=weibunny.kernel@gmail.com \
--cc=weibunny@fb.com \
--cc=willemdebruijn.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.