On Mon, 27 Jan 2025 14:31:10 +0100 Toke Høiland-Jørgensen wrote:
quoted
+
+/* page_pool_destroy or page_pool_disable_direct_recycling must be
called before
+ * netif_napi_del if pool->p.napi is set.
+ */
FWIW the comment is better placed on the warning, that's where people
will look when they hit it ;)
quoted
void page_pool_destroy(struct page_pool *pool);
void page_pool_use_xdp_mem(struct page_pool *pool, void (*disconnect)(void *),
const struct xdp_mem_info *mem);
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 5c4b788b811b..dc82767b2516 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -1161,6 +1161,8 @@ void page_pool_destroy(struct page_pool *pool)
if (!page_pool_put(pool))
return;
+ DEBUG_NET_WARN_ON(pool->p.napi && !napi_is_valid(pool->p.napi));
IDK what "napi_is_valid()" is. I think like this:
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index a3de752c5178..837ed36472db 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -1145,6 +1145,7 @@ void page_pool_disable_direct_recycling(struct page_pool *pool)
* pool and NAPI are unlinked when NAPI is disabled.
*/
WARN_ON(!test_bit(NAPI_STATE_SCHED, &pool->p.napi->state));
+ WARN_ON(!test_bit(NAPI_STATE_LISTED, &pool->p.napi->state));
WARN_ON(READ_ONCE(pool->p.napi->list_owner) != -1);
WRITE_ONCE(pool->p.napi, NULL);
Because page_pool_disable_direct_recycling() must also be called while
NAPI is listed. Technically we should also sync rcu if the driver calls
this directly, because NAPI may be reused :(
quoted
page_pool_disable_direct_recycling(pool);
page_pool_free_frag(pool);
Yeah, good idea; care to send a proper patch? :)
...for net-next ? :)