[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <dfd23dfd-e0dc-7329-261c-946b179d9bc5@linux.alibaba.com>
Date: Thu, 18 Aug 2022 16:37:44 +0800
From: Liu Song <liusong@...ux.alibaba.com>
To: Christoph Hellwig <hch@....de>,
Robin Murphy <robin.murphy@....com>, akpm@...ux-foundation.org
Cc: Marek Szyprowski <m.szyprowski@...sung.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>
Subject: Re: [PATCH v2] mm/dmapool.c: avoid duplicate memset within
dma_pool_alloc
A helper function "use_dev_coherent_memory" is introduced here to
>>>> determine whether the memory is allocated by "dma_alloc_from_dev_coherent".
>>>>
>>>> And use "get_dma_ops" to determine whether the memory is allocated by
>>>> "dma_direct_alloc".
> WTF? get_dma_ops is privat to the DMA API layer, and dmapool has no
> business even using that. Even independent of this particular case,
> consumers of an API never have any business looking at the implementation
> of the API, that is the whole point of the abstraction.
>
>> It's not even that, the change here is just obviously broken, since it ends
>> up entirely ignoring want_init_on_alloc() for devices using dma-direct.
>> Sure, the memory backing a dma_page is zeroed *once* by its initial
>> dma-coherent allocation, but who says we're not not reallocating pool
>> entries from an existing dma_page?
> And yes, in addition to that it also is completely broken.
After reading everyone's comments, I found that fixing this patch will
make the code look strange, so the benefits of the changes will be
dispensable, so I also agree to discard this patch.
Sorry for this trouble again.
Thanks
Powered by blists - more mailing lists