Re: [Intel-wired-lan] [PATCH net-next v11 12/12] libeth: xdp: access ->pp through netmem_desc instead of page
From: Byungchul Park
Date: Sun Jul 20 2025 - 21:03:51 EST
On Fri, Jul 18, 2025 at 10:32:38AM +0100, Pavel Begunkov wrote:
> On 7/18/25 10:18, Pavel Begunkov wrote:
> > On 7/18/25 02:14, Byungchul Park wrote:
> ...>>>> include/linux/mm.h:4176:54: note: expected 'struct page *' but argument is of type 'const struct page *'
> > > > > static inline bool page_pool_page_is_pp(struct page *page)
> > > > > ~~~~~~~~~~~~~^~~~
> > > >
> > > > Oh. page_pool_page_is_pp() in the mainline code already has this issue
> > > > that the helper cannot take const struct page * as argument.
> >
> > Probably not, and probably for wrong reasons. netmem_ref is define
> > as an integer, compilers cast away such const unlike const pointers.
>
> Taking a look libeth, at least at the reported spot it does
> page->pp->p.offset, that should be fine. And your problem
> is caused by the is_pp check in pp_page_to_nmdesc().
Exactly, but you asked me to add the check,
DEBUG_NET_WARN_ON_ONCE(!page_pool_page_is_pp(p)) in pp_page_to_nmdesc().
What I meant was, in order to apply that, page_pool_page_is_pp() should
take 'const struct page *' as argument.
I think it's good idea to change the proto type like, as you said:
static inline bool page_pool_page_is_pp(const struct page *page);
Thanks.
Byungchul
>
> --
> Pavel Begunkov
>