Re: [PATCH rfc v5 2/4] page_pool: add interface to manipulate frag count in page pool

From: Alexander Duyck
Date: Wed Jul 14 2021 - 10:46:36 EST


On Wed, Jul 14, 2021 at 3:18 AM Jesper Dangaard Brouer
<jbrouer@xxxxxxxxxx> wrote:
>
>
>
> On 14/07/2021 11.34, Yunsheng Lin wrote:
> > As suggested by Alexander, "A DMA mapping should be page
> > aligned anyway so the lower 12 bits would be reserved 0",
> > so it might make more sense to repurpose the lower 12 bits
> > of the dma address to store the frag count for frag page
> > support in page pool for 32 bit systems with 64 bit dma,
> > which should be rare those days.
>
> Do we have any real driver users with 32-bit arch and 64-bit DMA, that
> want to use this new frag-count system you are adding to page_pool?
>
> This "lower 12-bit use" complicates the code we need to maintain
> forever. My guess is that it is never used, but we need to update and
> maintain it, and it will never be tested.
>
> Why don't you simply reject using page_pool flag PP_FLAG_PAGE_FRAG
> during setup of the page_pool for this case?
>
> if ((pool->p.flags & PP_FLAG_PAGE_FRAG) &&
> (sizeof(dma_addr_t) > sizeof(unsigned long)))
> goto reject-setup;
>
>

That sounds good to me if we want to go that route. It would simplify
this quite a bit since essentially we could just drop these if blocks.

Thanks.

- Alex