From: Robin Murphy <robin.murphy@arm.com>
To: Christoph Hellwig <hch@lst.de>, iommu@lists.linux-foundation.org
Cc: x86@kernel.org, will@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma-mapping: remove CONFIG_DMA_REMAP
Date: Mon, 28 Feb 2022 10:32:54 +0000 [thread overview]
Message-ID: <4802e9fd-733f-3246-92f3-05f590e05d37@arm.com> (raw)
In-Reply-To: <20220227143533.357356-1-hch@lst.de>
On 2022-02-27 14:35, Christoph Hellwig wrote:
> CONFIG_DMA_REMAP is used to build a few helpers around the core
> vmalloc code, and to use them in case there is a highmem page in
> dma-direct, and to make dma coherent allocations be able to use
> non-contiguous pages allocations for DMA allocations in the dma-iommu
> layer.
>
> Right now it needs to be explicitly selected by architectures, and
> is only done so by architectures that require remapping to deal
> with devices that are not DMA coherent. Make it unconditional for
> builds with CONFIG_MMU as it is very little extra code, but makes
> it much more likely that large DMA allocations succeed on x86.
>
> This fixes hot plugging a NVMe thunderbolt SSD for me, which tries
> to allocate a 1MB buffer that is otherwise hard to obtain due to
> memory fragmentation on a heavily used laptop.
Simplifying the maze is most welcome, however one thing stands out...
[...]
> diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
> index 50f48e9e45987..fe1682fecdd57 100644
> --- a/kernel/dma/direct.c
> +++ b/kernel/dma/direct.c
> @@ -269,10 +269,10 @@ void *dma_direct_alloc(struct device *dev, size_t size,
> /*
> * Depending on the cma= arguments and per-arch setup,
> * dma_alloc_contiguous could return highmem pages.
> - * Without remapping there is no way to return them here, so
> - * log an error and fail.
> + * Without MMU-based remapping there is no way to return them
> + * here, so log an error and fail.
> */
> - if (!IS_ENABLED(CONFIG_DMA_REMAP)) {
> + if (!IS_ENABLED(CONFIG_MMU)) {
> dev_info(dev, "Rejecting highmem page from CMA.\n");
> goto out_free_pages;
> }
Is it even possible to hit this case now? From a quick look, all the
architectures defining HIGHMEM either have an explicit dependency on MMU
or don't allow deselecting it anyway (plus I don't see how HIGHMEM &&
!MMU could work in general), so I'm pretty sure this whole chunk should
go away now.
With that (or if there *is* some subtle wacky case where PageHighmem()
can actually return true for !MMU, a comment to remind us in future),
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Cheers,
Robin.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2022-02-28 10:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-27 14:35 [PATCH] dma-mapping: remove CONFIG_DMA_REMAP Christoph Hellwig
2022-02-28 10:32 ` Robin Murphy [this message]
2022-02-28 11:04 ` Christoph Hellwig
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=4802e9fd-733f-3246-92f3-05f590e05d37@arm.com \
--to=robin.murphy@arm.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/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