public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: dma_alloc_coherent and cache?
Date: Tue, 15 Apr 2014 12:49:14 +0200	[thread overview]
Message-ID: <4292964.mUEmdLVWYx@wuerfel> (raw)
In-Reply-To: <E94CEA02-A987-4212-A0CA-D0CDC80E7250@nowonline.co.uk>

On Tuesday 15 April 2014 14:01:39 Lee Essen wrote:
> > On 15 Apr 2014, at 12:43, Arnd Bergmann <arnd@arndb.de> wrote:
> > 
> > dma_alloc_coherent() is a wrapper around a device-specific allocator,
> > based on the dma_map_ops implementation. The default allocator
> > from arm_dma_ops gives you uncached, buffered memory. It is expected
> > that the driver uses a barrier (which is implied by readl/writel
> > but not __raw_readl/__raw_writel or readl_relaxed/writel_relaxed)
> > to ensure the write buffers are flushed.
> > 
> > If the machine sets arm_coherent_dma_ops rather than arm_dma_ops,
> > the memory will be cacheable, as it's assumed that the hardware
> > is set up for cache-coherent DMAs.
> 
> Hi,
> 
> The driver writes to the descriptor and then uses wmb() before enabling DMA. The descriptor is in dma_alloc_coherent() space, but the enable is a writel().

Ok

> > 
> > Can you post a link to the source code?
> > 
> >   Arnd
> 
> The code is available here:
> 
> http://www.nowonline.co.uk/scratch/le_netdev.c
> 
> It hangs consistently when it executes the txq_enable() on line 1280. Occasionally I see a corrupt packet on the wire, but mostly it's just a hang. If I uncomment all the printk's then it generally gets 20 or 30 packets out before it freezes.
> 


Unfortunately I don't see an obvious mistake with the DMA handling there,
I would try looking somewhere other than the dma code first. What
kind of freeze do you see? Does the entire machine hang, or is it
just the network interface that stops sending packets?

	Arnd

  reply	other threads:[~2014-04-15 10:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15  5:43 dma_alloc_coherent and cache? Lee Essen
2014-04-15  8:10 ` Andrew Lunn
2014-04-17 14:35   ` Valentin Longchamp
2014-04-15  8:43 ` Arnd Bergmann
2014-04-15 10:01   ` Lee Essen
2014-04-15 10:49     ` Arnd Bergmann [this message]
2014-04-15 16:22       ` Lee Essen
2014-04-15 16:49         ` Andrew Lunn
2014-04-15 21:54 ` Troy Kisky
2014-04-16 15:55   ` Lee Essen

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=4292964.mUEmdLVWYx@wuerfel \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.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