From: Nicolin Chen <nicoleotsuka@gmail.com>
To: Robin Murphy <robin.murphy@arm.com>, Christoph Hellwig <hch@lst.de>
Cc: chris@zankel.net, linux-xtensa@linux-xtensa.org,
keescook@chromium.org, sfr@canb.auug.org.au, tony@atomide.com,
catalin.marinas@arm.com, joro@8bytes.org, will.deacon@arm.com,
linux@armlinux.org.uk, iommu@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, jcmvbkbc@gmail.com,
wsa+renesas@sang-engineering.com, akpm@linux-foundation.org,
treding@nvidia.com, dwmw2@infradead.org, iamjoonsoo.kim@lge.com,
linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com
Subject: Re: [RFC/RFT PATCH 1/2] dma-contiguous: Simplify dma_*_from_contiguous() function calls
Date: Tue, 30 Apr 2019 12:46:13 -0700 [thread overview]
Message-ID: <20190430194612.GA31543@Asurada-Nvidia.nvidia.com> (raw)
In-Reply-To: <20190430151833.GB25447@lst.de>
On Tue, Apr 30, 2019 at 05:18:33PM +0200, Christoph Hellwig wrote:
> On Tue, Apr 30, 2019 at 01:37:54PM +0100, Robin Murphy wrote:
> > On 30/04/2019 11:56, Christoph Hellwig wrote:
> >> So while I really, really like this cleanup it turns out it isn't
> >> actually safe for arm :( arm remaps the CMA allocation in place
> >> instead of using a new mapping, which can be done because they don't
> >> share PMDs with the kernel.
> >>
> >> So we'll probably need a __dma_alloc_from_contiguous version with
> >> an additional bool fallback argument - everyone but arms uses
> >> dma_alloc_from_contiguous as in your patch, just arm will get the
> >> non-fallback one.
> >
> > Or we even just implement dma_{alloc,free}_contiguous() as a wrapper around
> > the existing APIs so that users can be thoroughly checked and converted
> > one-by-one.
>
> Yeah. Actually given all the contention I wonder if the easiest solution
> for now is to just open code the cma_alloc/cma_free calls in dma-direct
> and dma-iommu, with the hopes that everyone is going to migrate to those
> implementations in the mid-term anyway and dma_alloc_from_contiguous /
> dma_release_from_contiguous just go away..
Thanks for the comments.
Listing all the solutions as a summary:
A) Add "bool fallback" to dma_{alloc,free}_contiguous, and let
ARM use fallback=false.
B) Continue replacing "_from" with dma_{alloc,free}_contiguous
but let callers like ARM use cma_alloc/free() directly.
C) Have both new dma_{alloc,free}_contiguous and "_from" funcs.
Implement the new one to dma-direct only as an initial step
and change others one-by-one in the future.
Combining the comments at alloc_pages_node(), I guess that the
Solution C would be a better (cleaner) one?
List of to-change callers for Solution C:
kernel/dma/direct.c
List of to-exclude-for-now callers for Solution C:
arch/arm64/mm/dma-mapping.c
drivers/iommu/amd_iommu.c
drivers/iommu/intel-iommu.c
arch/arm/mm/dma-mapping.c
arch/xtensa/kernel/pci-dma.c
kernel/dma/remap.c
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-04-30 19:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-30 1:55 [RFC/RFT PATCH 0/2] Optimize dma_*_from_contiguous calls Nicolin Chen
2019-04-30 1:55 ` [RFC/RFT PATCH 1/2] dma-contiguous: Simplify dma_*_from_contiguous() function calls Nicolin Chen
2019-04-30 10:56 ` Christoph Hellwig
2019-04-30 12:37 ` Robin Murphy
2019-04-30 15:18 ` Christoph Hellwig
2019-04-30 19:46 ` Nicolin Chen [this message]
2019-04-30 12:52 ` Robin Murphy
2019-04-30 15:20 ` Christoph Hellwig
2019-04-30 1:55 ` [RFC/RFT PATCH 2/2] dma-contiguous: Use fallback alloc_pages for single pages Nicolin Chen
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=20190430194612.GA31543@Asurada-Nvidia.nvidia.com \
--to=nicoleotsuka@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=chris@zankel.net \
--cc=dwmw2@infradead.org \
--cc=hch@lst.de \
--cc=iamjoonsoo.kim@lge.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jcmvbkbc@gmail.com \
--cc=joro@8bytes.org \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xtensa@linux-xtensa.org \
--cc=linux@armlinux.org.uk \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@arm.com \
--cc=sfr@canb.auug.org.au \
--cc=tony@atomide.com \
--cc=treding@nvidia.com \
--cc=will.deacon@arm.com \
--cc=wsa+renesas@sang-engineering.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;
as well as URLs for NNTP newsgroup(s).