linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* alloc_safe_buffer/map_single problem related to ath9k on ARM
@ 2011-09-19 22:26 B. J.
  2011-09-19 22:36 ` Russell King - ARM Linux
  0 siblings, 1 reply; 2+ messages in thread
From: B. J. @ 2011-09-19 22:26 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

I've been fighting with a DMA problem on my ARM system, and have reached the point of crying out for a bit of help.  Hopefully someone has some ideas on what I can do to get past this...

The platform in question is an IXP43x-based processor with an ath9k WiFi on the PCI bus, running a late 2.6.3x kernel (have been experimenting with different versions to no avail).

The original problem is that, under network load over the WiFi, I get these messages:

ath9k 0000:00:02.0: alloc_safe_buffer: could not alloc dma memory (size=87)
ath9k 0000:00:02.0: map_single: unable to map unsafe buffer cf733828!
ath9k 0000:00:02.0: alloc_safe_buffer: could not alloc dma memory (size=174)
ath9k 0000:00:02.0: map_single: unable to map unsafe buffer c7ea4c5e!
ath9k 0000:00:02.0: alloc_safe_buffer: could not alloc dma memory (size=1484)
ath9k 0000:00:02.0: map_single: unable to map unsafe buffer cf734028!

and eventually the system runs out of kernel memory and the OOM killer kicks in (yeah, so there's multiple problems here).

I've been experimenting with various DMA/bounce-buffer patches, HIGHMEM configuration, and changing CONSISTENT_DMA_SIZE from 2M to 4M, but none of the changes resolve this problem, and the latter just causes a kernel assertion failure.

My understanding of what's causing this is that there is a really tiny amount of DMA-able memory available - 2MB - and I'm overrunning that while beating on the WiFi.  I'm not knowledgeable enough about the particulars of this platform to understand if it really is limited to 2MB of DMA memory (that seems crazily tiny!) or if this is a problem in the ath9k driver itself.

Here are some details:

Linux 2.6.35.12 armv5teb
...
CPU: XScale-IXP43x Family [69054041] revision 1 (ARMv5TE), cr=000039ff
...
free_area_init_node: node 0, pgdat c03dc890, node_mem_map c4000000
  DMA zone: 128 pages used for memmap
  DMA zone: 0 pages reserved
  DMA zone: 16256 pages, LIFO batch:3
  Normal zone: 384 pages used for memmap
  Normal zone: 48768 pages, LIFO batch:15
...
Memory: 256MB = 256MB total
Memory: 255756k/255756k available, 6388k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    DMA     : 0xffc00000 - 0xffe00000   (   2 MB)
    vmalloc : 0xd0800000 - 0xff000000   ( 744 MB)
    lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .init : 0xc0008000 - 0xc0023000   ( 108 kB)
      .text : 0xc0023000 - 0xc03b6000   (3660 kB)
      .data : 0xc03b6000 - 0xc03de260   ( 161 kB)

# cat /sys/devices/pci0000\:00/0000\:00\:02.0/pools 
poolinfo - 0.1
large_dmabounce_pool    0    0 4096  0
small_dmabounce_pool   21   50 2048 25
# cat /sys/devices/pci0000\:00/0000\:00\:02.0/dmabounce_stats
1113 0 0 1113 28292 1092
# 

Any advice appreciated!

--
-bp

^ permalink raw reply	[flat|nested] 2+ messages in thread

* alloc_safe_buffer/map_single problem related to ath9k on ARM
  2011-09-19 22:26 alloc_safe_buffer/map_single problem related to ath9k on ARM B. J.
@ 2011-09-19 22:36 ` Russell King - ARM Linux
  0 siblings, 0 replies; 2+ messages in thread
From: Russell King - ARM Linux @ 2011-09-19 22:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 19, 2011 at 03:26:54PM -0700, B. J. wrote:
> The original problem is that, under network load over the WiFi, I get
> these messages:
> 
> ath9k 0000:00:02.0: alloc_safe_buffer: could not alloc dma memory (size=87)
> ath9k 0000:00:02.0: map_single: unable to map unsafe buffer cf733828!
> ath9k 0000:00:02.0: alloc_safe_buffer: could not alloc dma memory (size=174)
> ath9k 0000:00:02.0: map_single: unable to map unsafe buffer c7ea4c5e!
> ath9k 0000:00:02.0: alloc_safe_buffer: could not alloc dma memory (size=1484)
> ath9k 0000:00:02.0: map_single: unable to map unsafe buffer cf734028!
> 
> and eventually the system runs out of kernel memory and the OOM killer
> kicks in (yeah, so there's multiple problems here).

It shouldn't end up running out of memory - that implies there's a leak
somewhere.  And I think I know where it is - could you try this patch
please?  It won't solve the messages above but it should prevent the
resulting OOM.

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 0a0a1e7..c3ff82f 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -324,6 +324,8 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
 
 	if (addr)
 		*handle = pfn_to_dma(dev, page_to_pfn(page));
+	else
+		__dma_free_buffer(page, size);
 
 	return addr;
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-19 22:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-19 22:26 alloc_safe_buffer/map_single problem related to ath9k on ARM B. J.
2011-09-19 22:36 ` Russell King - ARM Linux

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).