[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHS8izMyS_y0o9EzJ8NaLnS99KYH+Ze6BaSw=+=hPPnuS9zP8A@mail.gmail.com>
Date: Mon, 24 Mar 2025 22:34:43 -0700
From: Mina Almasry <almasrymina@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, andrew+netdev@...n.ch, horms@...nel.org, sdf@...ichev.me
Subject: Re: [PATCH net-next v2 07/11] net: protect rxq->mp_params with the
instance lock
On Mon, Mar 24, 2025 at 3:47 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> Ensure that all accesses to mp_params are under the netdev
> instance lock. The only change we need is to move
> dev_memory_provider_uninstall() under the lock.
>
> Appropriately swap the asserts.
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
Reviewed-by: Mina Almasry <almasrymina@...gle.com>
> ---
> net/core/dev.c | 4 ++--
> net/core/page_pool.c | 7 ++-----
> 2 files changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 690d46497b2f..652f2c6f5674 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -10353,7 +10353,7 @@ u32 dev_get_min_mp_channel_count(const struct net_device *dev)
> {
> int i;
>
> - ASSERT_RTNL();
> + netdev_ops_assert_locked(dev);
>
> for (i = dev->real_num_rx_queues - 1; i >= 0; i--)
> if (dev->_rx[i].mp_params.mp_priv)
> @@ -11957,9 +11957,9 @@ void unregister_netdevice_many_notify(struct list_head *head,
> dev_tcx_uninstall(dev);
> netdev_lock_ops(dev);
> dev_xdp_uninstall(dev);
> + dev_memory_provider_uninstall(dev);
> netdev_unlock_ops(dev);
> bpf_dev_bound_netdev_unregister(dev);
> - dev_memory_provider_uninstall(dev);
So initially I thought this may be wrong because netdev_lock_ops()
only locks if there are queue_mgmt_ops, but access to mp_params should
be locked anyway. But I guess you're relying on the fact that if the
device doesn't support queue_mgmt_ops memory providers don't work
anyway.
--
Thanks,
Mina
Powered by blists - more mailing lists