lkml.org 
[lkml]   [2022]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] dma-mapping: check dma_mask for streaming mapping allocs
On 02/22/22 at 04:59pm, Christoph Hellwig wrote:
> On Tue, Feb 22, 2022 at 09:41:43PM +0800, Baoquan He wrote:
> > For newly added streaming mapping APIs, the internal core function
> > __dma_alloc_pages() should check dev->dma_mask, but not
> > ev->coherent_dma_mask which is for coherent mapping.
>
> No, this is wrong. dev->coherent_dma_mask is and should be used here.

Could you tell more why this is wrong? According to
Documentation/core-api/dma-api.rst and DMA code, __dma_alloc_pages() is
the core function of dma_alloc_pages()/dma_alloc_noncoherent() which are
obviously streaming mapping, why do we need to check
dev->coherent_dma_mask here? Because dev->coherent_dma_mask is the subset
of dev->dma_mask, it's safer to use dev->coherent_dma_mask in these
places? This is confusing, I talked to Hyeonggon in private mail, he has
the same feeling.

>
> >
> >
> > Meanwhile, just filter out gfp flags if they are any of
> > __GFP_DMA, __GFP_DMA32 and __GFP_HIGHMEM, but not fail it. This change
> > makes it consistent with coherent mapping allocs.
>
> This is wrong as well. We want to eventually fail dma_alloc_coherent
> for these, too. It just needs more work.
>

\
 
 \ /
  Last update: 2022-02-23 01:29    [W:0.101 / U:0.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site