Re: [PATCH net-next v1] page_pool: check for dma_sync_size earlier

From: Furong Xu
Date: Tue Oct 15 2024 - 22:32:54 EST


Hi Ilias,

On Tue, 15 Oct 2024 16:25:51 +0300, Ilias Apalodimas <ilias.apalodimas@xxxxxxxxxx> wrote:

> I am not sure I understand the problem here. If we are about to call
> page_pool_return_page() we don't care what happens to that page.
> If we end up calling __page_pool_put_page() it's the *callers* job now
> to sync the page now once all fragments are released. So why is this
> different from syncing an entire page?
>
> >
> > >
> > > Ok, since we do have a page_pool_put_full_page(), adding a variant for
> > > the nosync seems reasonable.
> > > But can't the check above be part of that function instead of the core code?
> >
> > I was thinking about something like below mirroring page_pool_put_full_page()
> > for simplicity:
> > static inline void page_pool_put_page_nosync(struct page_pool *pool,
> > struct page *page, bool allow_direct)
> > {
> > page_pool_put_netmem(pool, page_to_netmem(page), 0, allow_direct);
> > }
> >
>
> Yes, that's ok. But the question was about moving the !dma_sync_size warning.
> On second thought I think it's better if we leave it on the core code.
> But as I said above I am not sure why we need it.

You can read this:
https://git.kernel.org/netdev/net/c/b514c47ebf41
https://git.kernel.org/netdev/net/c/5546da79e6cc

drivers/net/ethernet/renesas/ravb_main.c and
drivers/net/ethernet/freescale/fec_main.c are calling page_pool_put_page() with
dma_sync_size setting to 0.

I will send another patchset to add page_pool_put_page_nosync() as
Yunsheng Lin suggested, then convert drivers/net/ethernet/renesas/ravb_main.c
and drivers/net/ethernet/freescale/fec_main.c to the new
page_pool_put_page_nosync().