LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Hante Meuleman <meuleman@broadcom.com>,
linux-wireless <linux-wireless@vger.kernel.org>,
brcm80211-dev-list <brcm80211-dev-list@broadcom.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Will Deacon <Will.Deacon@arm.com>,
Arend Van Spriel <arend@broadcom.com>,
David Miller <davem@davemloft.net>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: using DMA-API on ARM
Date: Fri, 5 Dec 2014 18:28:51 +0000 [thread overview]
Message-ID: <20141205182851.GC31222@e104818-lin.cambridge.arm.com> (raw)
In-Reply-To: <20141205150648.GT11285@n2100.arm.linux.org.uk>
On Fri, Dec 05, 2014 at 03:06:48PM +0000, Russell King - ARM Linux wrote:
> I've been doing more digging into the current DMA code, and I'm dismayed
> to see that there's new bugs in it...
>
> commit 513510ddba9650fc7da456eefeb0ead7632324f6
> Author: Laura Abbott <lauraa@codeaurora.org>
> Date: Thu Oct 9 15:26:40 2014 -0700
>
> common: dma-mapping: introduce common remapping functions
>
> This uses map_vm_area() to achieve the remapping of pages allocated inside
> dma_alloc_coherent(). dma_alloc_coherent() is documented in a rather
> round-about way in Documentation/DMA-API.txt:
>
> | Part Ia - Using large DMA-coherent buffers
> | ------------------------------------------
> |
> | void *
> | dma_alloc_coherent(struct device *dev, size_t size,
> | dma_addr_t *dma_handle, gfp_t flag)
> |
> | void
> | dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
> | dma_addr_t dma_handle)
> |
> | Free a region of consistent memory you previously allocated. dev,
> | size and dma_handle must all be the same as those passed into
> | dma_alloc_coherent(). cpu_addr must be the virtual address returned by
> | the dma_alloc_coherent().
> |
> | Note that unlike their sibling allocation calls, these routines
> | may only be called with IRQs enabled.
>
> Note that very last paragraph. What this says is that it is explicitly
> permitted to call dma_alloc_coherent() with IRQs disabled.
This is solved by using a pre-allocated, pre-mapped atomic_pool which
avoids any further mapping. __dma_alloc() calls __alloc_from_pool() when
!__GFP_WAIT.
This code got pretty complex and we may find bugs. It can be simplified
by a pre-allocated non-cacheable region that is safe in atomic context
(how big you allocate this is hard to say).
> If the problem which you (Broadcom) are suffering from is down to the
> issue I suspect (that being having mappings with different cache
> attributes) then I'm not sure that there's anything we can realistically
> do about that. There's a number of issues which make it hard to see a
> way forward.
I'm still puzzled by this problem, so I don't have any suggestion yet. I
wouldn't blame the mismatched attributes yet as I haven't seen such
problem in practice (but you never know).
How does the DT describe this device? Could it have some dma-coherent
property in there that causes dma_alloc_coherent() to create a cacheable
memory?
The reverse could also cause problems: the device is coherent but the
CPU creates a non-cacheable mapping.
--
Catalin
next prev parent reply other threads:[~2014-12-05 18:29 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-05 9:22 Arend van Spriel
2014-12-05 9:45 ` Russell King - ARM Linux
2014-12-05 12:24 ` Will Deacon
2014-12-05 12:56 ` Hante Meuleman
2014-12-05 13:23 ` Russell King - ARM Linux
2014-12-05 14:20 ` Hante Meuleman
2014-12-05 14:47 ` Arend van Spriel
2014-12-08 13:47 ` Hante Meuleman
2014-12-08 15:01 ` Arnd Bergmann
2014-12-08 15:17 ` Russell King - ARM Linux
2014-12-08 15:22 ` Arnd Bergmann
2014-12-08 16:03 ` Catalin Marinas
2014-12-08 17:01 ` Arend van Spriel
2014-12-09 10:19 ` Arend van Spriel
2014-12-09 10:29 ` Russell King - ARM Linux
2014-12-09 11:07 ` Arend van Spriel
2014-12-09 11:54 ` Catalin Marinas
2015-01-20 15:22 ` Fabio Estevam
2014-12-08 16:22 ` Arend van Spriel
2014-12-08 16:38 ` Arnd Bergmann
2014-12-08 16:47 ` Russell King - ARM Linux
2014-12-08 16:50 ` Catalin Marinas
2014-12-08 16:54 ` Russell King - ARM Linux
2014-12-05 15:06 ` Russell King - ARM Linux
2014-12-05 18:28 ` Catalin Marinas [this message]
2014-12-05 19:22 ` Arend van Spriel
2014-12-05 19:25 ` Russell King - ARM Linux
2014-12-05 12:43 ` Arend van Spriel
2014-12-05 12:59 ` Russell King - ARM Linux
2014-12-05 9:52 ` Arnd Bergmann
2014-12-05 11:11 ` Russell King - ARM Linux
2014-12-05 11:49 ` Hante Meuleman
2014-12-05 17:38 ` Catalin Marinas
2014-12-05 18:24 ` Russell King - ARM Linux
2014-12-05 18:31 ` Catalin Marinas
2014-12-05 18:39 ` Catalin Marinas
2014-12-05 18:53 ` Catalin Marinas
2014-12-05 19:50 ` Arend van Spriel
2014-12-08 12:55 ` Johannes Stezenbach
2014-12-08 15:55 ` Catalin Marinas
2014-12-08 16:50 ` Johannes Stezenbach
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=20141205182851.GC31222@e104818-lin.cambridge.arm.com \
--to=catalin.marinas@arm.com \
--cc=Will.Deacon@arm.com \
--cc=arend@broadcom.com \
--cc=brcm80211-dev-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=m.szyprowski@samsung.com \
--cc=meuleman@broadcom.com \
--subject='Re: using DMA-API on ARM' \
/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
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).