Re: use exact allocation for dma coherent memory

From: Arend Van Spriel
Date: Tue Jul 02 2019 - 05:48:52 EST




On 7/1/2019 10:48 AM, Christoph Hellwig wrote:
On Fri, Jun 14, 2019 at 03:47:10PM +0200, Christoph Hellwig wrote:
Switching to a slightly cleaned up alloc_pages_exact is pretty easy,
but it turns out that because we didn't filter valid gfp_t flags
on the DMA allocator, a bunch of drivers were passing __GFP_COMP
to it, which is rather bogus in too many ways to explain. Arm has
been filtering it for a while, but this series instead tries to fix
the drivers and warn when __GFP_COMP is passed, which makes it much
larger than just adding the functionality.

Dear driver maintainers,

can you look over the patches touching your drivers, please? I'd
like to get as much as possible of the driver patches into this
merge window, so that it can you through your maintainer trees.

You made me look ;-) Actually not touching my drivers so I'm off the hook. However, I was wondering if drivers could know so I decided to look into the DMA-API.txt documentation which currently states:

"""
The flag parameter (dma_alloc_coherent() only) allows the caller to
specify the ``GFP_`` flags (see kmalloc()) for the allocation (the
implementation may choose to ignore flags that affect the location of
the returned memory, like GFP_DMA).
"""

I do expect you are going to change that description as well now that you are going to issue a warning on __GFP_COMP. Maybe include that in patch 15/16 where you introduce that warning.

Regards,
Arend