lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87y0v22dzn.fsf@toke.dk>
Date: Mon, 12 May 2025 14:46:36 +0200
From: Toke Høiland-Jørgensen <toke@...hat.com>
To: Byungchul Park <byungchul@...com>, willy@...radead.org,
 netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
 kernel_team@...ynix.com, kuba@...nel.org, almasrymina@...gle.com,
 ilias.apalodimas@...aro.org, harry.yoo@...cle.com, hawk@...nel.org,
 akpm@...ux-foundation.org, ast@...nel.org, daniel@...earbox.net,
 davem@...emloft.net, john.fastabend@...il.com, andrew+netdev@...n.ch,
 edumazet@...gle.com, pabeni@...hat.com, vishal.moola@...il.com
Subject: Re: [RFC 13/19] page_pool: expand scope of is_pp_{netmem,page}() to
 global

Byungchul Park <byungchul@...com> writes:

> Other than skbuff.c might need to check if a page or netmem is for page
> pool, for example, page_alloc.c needs to check the page state, whether
> it comes from page pool or not for their own purpose.
>
> Expand the scope of is_pp_netmem() and introduce is_pp_page() newly, so
> that those who want to check the source can achieve the checking without
> accessing page pool member, page->pp_magic, directly.
>
> Signed-off-by: Byungchul Park <byungchul@...com>
> ---
>  include/net/page_pool/types.h |  2 ++
>  net/core/page_pool.c          | 10 ++++++++++
>  net/core/skbuff.c             |  5 -----
>  3 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h
> index 36eb57d73abc6..d3e1a52f01e09 100644
> --- a/include/net/page_pool/types.h
> +++ b/include/net/page_pool/types.h
> @@ -299,4 +299,6 @@ static inline bool is_page_pool_compiled_in(void)
>  /* Caller must provide appropriate safe context, e.g. NAPI. */
>  void page_pool_update_nid(struct page_pool *pool, int new_nid);
>  
> +bool is_pp_netmem(netmem_ref netmem);
> +bool is_pp_page(struct page *page);
>  #endif /* _NET_PAGE_POOL_H */
> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> index b61c1038f4c68..9c553e5a1b555 100644
> --- a/net/core/page_pool.c
> +++ b/net/core/page_pool.c
> @@ -1225,3 +1225,13 @@ void net_mp_niov_clear_page_pool(struct netmem_desc *niov)
>  
>  	page_pool_clear_pp_info(netmem);
>  }
> +
> +bool is_pp_netmem(netmem_ref netmem)
> +{
> +	return (netmem_get_pp_magic(netmem) & ~0x3UL) == PP_SIGNATURE;
> +}
> +
> +bool is_pp_page(struct page *page)
> +{
> +	return is_pp_netmem(page_to_netmem(page));
> +}
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 6cbf77bc61fce..11098c204fe3e 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -893,11 +893,6 @@ static void skb_clone_fraglist(struct sk_buff *skb)
>  		skb_get(list);
>  }
>  
> -static bool is_pp_netmem(netmem_ref netmem)
> -{
> -	return (netmem_get_pp_magic(netmem) & ~0x3UL) == PP_SIGNATURE;
> -}
> -

This has already been moved to mm.h (and the check changed) by commit:

cd3c93167da0 ("page_pool: Move pp_magic check into helper functions")

You should definitely rebase this series on top of that (and the
subsequent ee62ce7a1d90 ("page_pool: Track DMA-mapped pages and unmap
them when destroying the pool")), as these change the semantics of how
page_pool interacts with struct page.

Both of these are in net-next, which Mina already asked you to rebase
on, so I guess you'll pick it up there, put flagging it here just for
completeness :)

-Toke


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ