From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, sdf@fomichev.me,
Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next v2 07/11] net: protect rxq->mp_params with the instance lock
Date: Mon, 24 Mar 2025 15:45:33 -0700 [thread overview]
Message-ID: <20250324224537.248800-8-kuba@kernel.org> (raw)
In-Reply-To: <20250324224537.248800-1-kuba@kernel.org>
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@kernel.org>
---
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);
netdev_offload_xstats_disable_all(dev);
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index acef1fcd8ddc..7745ad924ae2 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -11,6 +11,7 @@
#include <linux/slab.h>
#include <linux/device.h>
+#include <net/netdev_lock.h>
#include <net/netdev_rx_queue.h>
#include <net/page_pool/helpers.h>
#include <net/page_pool/memory_provider.h>
@@ -279,11 +280,7 @@ static int page_pool_init(struct page_pool *pool,
get_device(pool->p.dev);
if (pool->slow.flags & PP_FLAG_ALLOW_UNREADABLE_NETMEM) {
- /* We rely on rtnl_lock()ing to make sure netdev_rx_queue
- * configuration doesn't change while we're initializing
- * the page_pool.
- */
- ASSERT_RTNL();
+ netdev_assert_locked(pool->slow.netdev);
rxq = __netif_get_rx_queue(pool->slow.netdev,
pool->slow.queue_idx);
pool->mp_priv = rxq->mp_params.mp_priv;
--
2.49.0
next prev parent reply other threads:[~2025-03-24 22:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-24 22:45 [PATCH net-next v2 00/11] net: skip taking rtnl_lock for queue GET Jakub Kicinski
2025-03-24 22:45 ` [PATCH net-next v2 01/11] net: bubble up taking netdev instance lock to callers of net_devmem_unbind_dmabuf() Jakub Kicinski
2025-03-25 5:19 ` Mina Almasry
2025-03-24 22:45 ` [PATCH net-next v2 02/11] net: remove netif_set_real_num_rx_queues() helper for when SYSFS=n Jakub Kicinski
2025-03-24 22:45 ` [PATCH net-next v2 03/11] net: constify dev pointer in misc instance lock helpers Jakub Kicinski
2025-03-24 22:45 ` [PATCH net-next v2 04/11] net: explain "protection types" for the instance lock Jakub Kicinski
2025-03-24 22:45 ` [PATCH net-next v2 05/11] net: designate queue counts as "double ops protected" by " Jakub Kicinski
2025-03-24 22:45 ` [PATCH net-next v2 06/11] net: designate queue -> napi linking as "ops protected" Jakub Kicinski
2025-03-24 22:45 ` Jakub Kicinski [this message]
2025-03-25 5:34 ` [PATCH net-next v2 07/11] net: protect rxq->mp_params with the instance lock Mina Almasry
2025-03-25 9:50 ` Jakub Kicinski
2025-03-24 22:45 ` [PATCH net-next v2 08/11] net: make NETDEV_UNREGISTER and instance lock more consistent Jakub Kicinski
2025-03-25 12:17 ` Cosmin Ratiu
2025-03-25 17:04 ` Jakub Kicinski
2025-03-24 22:45 ` [PATCH net-next v2 09/11] net: designate XSK pool pointers in queues as "ops protected" Jakub Kicinski
2025-03-24 22:45 ` [PATCH net-next v2 10/11] netdev: add "ops compat locking" helpers Jakub Kicinski
2025-03-24 22:45 ` [PATCH net-next v2 11/11] netdev: don't hold rtnl_lock over nl queue info get when possible Jakub Kicinski
2025-03-25 4:04 ` [PATCH net-next v2 00/11] net: skip taking rtnl_lock for queue GET Stanislav Fomichev
2025-03-25 17:30 ` patchwork-bot+netdevbpf
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=20250324224537.248800-8-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
/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;
as well as URLs for NNTP newsgroup(s).