mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2026-01-27 12:47:24 +01:00
net: page_pool: avoid false positive warning if NAPI was never added
We expect NAPI to be in disabled state when page pool is torn down. But it is also legal if the NAPI is completely uninitialized. Reviewed-by: Mina Almasry <almasrymina@google.com> Link: https://patch.msgid.link/20250206225638.1387810-4-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
3e7efc3f4f
commit
c1e00bc4be
|
|
@ -299,6 +299,18 @@ void xdp_do_check_flushed(struct napi_struct *napi);
|
|||
static inline void xdp_do_check_flushed(struct napi_struct *napi) { }
|
||||
#endif
|
||||
|
||||
/* Best effort check that NAPI is not idle (can't be scheduled to run) */
|
||||
static inline void napi_assert_will_not_race(const struct napi_struct *napi)
|
||||
{
|
||||
/* uninitialized instance, can't race */
|
||||
if (!napi->poll_list.next)
|
||||
return;
|
||||
|
||||
/* SCHED bit is set on disabled instances */
|
||||
WARN_ON(!test_bit(NAPI_STATE_SCHED, &napi->state));
|
||||
WARN_ON(READ_ONCE(napi->list_owner) != -1);
|
||||
}
|
||||
|
||||
void kick_defer_list_purge(struct softnet_data *sd, unsigned int cpu);
|
||||
|
||||
#define XMIT_RECURSION_LIMIT 8
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <trace/events/page_pool.h>
|
||||
|
||||
#include "dev.h"
|
||||
#include "mp_dmabuf_devmem.h"
|
||||
#include "netmem_priv.h"
|
||||
#include "page_pool_priv.h"
|
||||
|
|
@ -1147,11 +1148,7 @@ void page_pool_disable_direct_recycling(struct page_pool *pool)
|
|||
if (!pool->p.napi)
|
||||
return;
|
||||
|
||||
/* To avoid races with recycling and additional barriers make sure
|
||||
* pool and NAPI are unlinked when NAPI is disabled.
|
||||
*/
|
||||
WARN_ON(!test_bit(NAPI_STATE_SCHED, &pool->p.napi->state));
|
||||
WARN_ON(READ_ONCE(pool->p.napi->list_owner) != -1);
|
||||
napi_assert_will_not_race(pool->p.napi);
|
||||
|
||||
mutex_lock(&page_pools_lock);
|
||||
WRITE_ONCE(pool->p.napi, NULL);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user