From: Liu Song <liusong@linux.alibaba.com>
To: Christoph Hellwig <hch@lst.de>,
Robin Murphy <robin.murphy@arm.com>,
akpm@linux-foundation.org
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>
Subject: Re: [PATCH v2] mm/dmapool.c: avoid duplicate memset within dma_pool_alloc
Date: Thu, 18 Aug 2022 16:37:44 +0800 [thread overview]
Message-ID: <dfd23dfd-e0dc-7329-261c-946b179d9bc5@linux.alibaba.com> (raw)
In-Reply-To: <20220817053628.GA28747@lst.de>
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
prev parent reply other threads:[~2022-08-18 10:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-18 6:28 Liu Song
[not found] ` <CGME20220816123958eucas1p1b03a5efa1f5804245a5c1a9b27529015@eucas1p1.samsung.com>
2022-08-16 12:39 ` Marek Szyprowski
2022-08-16 15:00 ` Robin Murphy
2022-08-17 2:03 ` Liu Song
2022-08-17 5:36 ` Christoph Hellwig
2022-08-18 8:37 ` Liu Song [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dfd23dfd-e0dc-7329-261c-946b179d9bc5@linux.alibaba.com \
--to=liusong@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=hch@lst.de \
--cc=iommu@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox