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 v10 net-next 3/5] psp: add a new netdev event for dev unregister
Date: Mon, 6 Apr 2026 10:12:32 -0400 [thread overview]
Message-ID: <c502c837-6f01-4854-bd6b-e81aba940dc8@gmail.com> (raw)
In-Reply-To: <20260405055853.3285534-4-weibunny.kernel@gmail.com>
On 4/5/26 1:58 AM, Wei Wang wrote:
> From: Wei Wang <weibunny@fb.com>
>
> Add a new netdev event for dev unregister and handle the removal of this
> dev from psp->assoc_dev_list, upon the first dev-assoc operation.
>
> Signed-off-by: Wei Wang <weibunny@fb.com>
> ---
...
> +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).
> + */
> +int psp_attach_netdev_notifier(void)
> +{
> + int err = 0;
> +
> + if (READ_ONCE(psp_notifier_registered))
> + return 0;
> +
> + mutex_lock(&psp_devs_lock);
> + if (!psp_notifier_registered) {
> + err = register_netdevice_notifier(&psp_netdev_notifier);
> + if (!err)
> + WRITE_ONCE(psp_notifier_registered, true);
> + }
> + mutex_unlock(&psp_devs_lock);
> +
> + return err;
> +}
> +
This looks like an abuse of the psp_devs_lock to provide mutual
exclusion on psp_notifier_registered, which has the undesirable property
of establishing a lock dependency from psp_devs_lock -> rtnl_lock.
Perhaps a dedicated mutex would be cleaner.
>
> +/**
> + * Non-admin version of psp_device_get_locked() + psp_attach_netdev_notifier()
> + * only used for dev-assoc.
> + */
> +int psp_device_get_locked_dev_assoc(const struct genl_split_ops *ops,
> + struct sk_buff *skb, struct genl_info *info)
kdoc open, but not a kdoc comment.
Minor comments, otherwise:
Reviewed-by: Daniel Zahka <daniel.zahka@gmail.com>
next prev parent reply other threads:[~2026-04-06 14:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-05 5:58 [PATCH v10 net-next 0/5] psp: Add support for dev-assoc/disassoc Wei Wang
2026-04-05 5:58 ` [PATCH v10 net-next 1/5] psp: add admin/non-admin version of psp_device_get_locked Wei Wang
2026-04-06 11:11 ` Daniel Zahka
2026-04-05 5:58 ` [PATCH v10 net-next 2/5] psp: add new netlink cmd for dev-assoc and dev-disassoc Wei Wang
2026-04-06 13:27 ` Daniel Zahka
2026-04-05 5:58 ` [PATCH v10 net-next 3/5] psp: add a new netdev event for dev unregister Wei Wang
2026-04-06 14:12 ` Daniel Zahka [this message]
2026-04-05 5:58 ` [PATCH v10 net-next 4/5] selftests/net: Add bpf skb forwarding program Wei Wang
2026-04-05 5:58 ` [PATCH v10 net-next 5/5] selftest/net: psp: Add test for dev-assoc/disassoc 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=c502c837-6f01-4854-bd6b-e81aba940dc8@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox