I've run into "PCI-DMA: Out of IOMMU space" messages after loading and
unloading a module 30 times. The interesting thing is this only
happens if I have > 4 GB of memory. The box this occurs has AMD Phenom
quad core CPU so I take it a harware IOMMU is being used. Below are
example relevant messages with > 4 GB and then < 4 GB of memory. The
driver I tested this with was ath9k. It could be an issue perhaps with
ath9k but I am unable to find an issue in our probe/removal.
Could this be an issue with the AMD IOMMU used? Or is it more likely a
driver issue?
With > 4 GB of RAM:
phy0: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011820000, irq=19
phy1: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20012520000, irq=19
phy2: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
phy3: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117c0000, irq=19
phy4: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
phy5: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117c0000, irq=19
phy6: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
phy7: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117c0000, irq=19
phy8: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
phy9: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117c0000, irq=19
phy10: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
phy11: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117c0000, irq=19
phy12: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
phy13: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117c0000, irq=19
phy14: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
phy15: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117c0000, irq=19
phy16: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
phy17: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117c0000, irq=19
phy18: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
phy19: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117c0000, irq=19
phy20: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
phy21: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117c0000, irq=19
phy22: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
phy23: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117c0000, irq=19
phy24: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
phy25: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117c0000, irq=19
phy26: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
phy27: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117c0000, irq=19
phy28: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
phy29: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117c0000, irq=19
phy30: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200117a0000, irq=19
ath9k 0000:01:06.0: PCI-DMA: Out of IOMMU space for 3904 bytes
ath9k 0000:01:06.0: PCI-DMA: Out of IOMMU space for 3904 bytes
ath9k 0000:01:06.0: PCI-DMA: Out of IOMMU space for 3904 bytes
... etc
The full log can be seen at:
http://bombadil.infradead.org/~mcgrof/logs/log-out-of-mem-full
With < 4GB RAM:
phy0: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011200000, irq=19
phy1: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200125a0000, irq=19
phy2: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy3: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
phy4: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy5: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
phy6: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy7: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
phy8: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy9: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
phy10: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy11: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
phy12: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy13: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
phy14: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy15: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
phy16: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy17: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
phy18: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy19: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
phy20: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy21: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
phy22: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy23: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
phy24: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy25: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
phy26: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy27: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
phy28: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy29: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
phy30: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc200110a0000, irq=19
phy31: Atheros AR5416 MAC/BB Rev:2 AR2122 RF Rev:81:
mem=0xffffc20011140000, irq=19
..etc goes on and on
The full log can be seen at:
http://bombadil.infradead.org/~mcgrof/logs/log-out-of-mem-full-NOT
Luis
On Mon, Mar 16, 2009 at 12:15 PM, Luis R. Rodriguez <[email protected]> wrote:
> I've run into "PCI-DMA: Out of IOMMU space" messages after loading and
> unloading a module 30 times. The interesting thing is this only
> happens if I have > 4 GB of memory. The box this occurs has AMD Phenom
> quad core CPU so I take it a harware IOMMU is being used. Below are
> example relevant messages with > 4 GB and then < 4 GB of memory. The
> driver I tested this with was ath9k. It could be an issue perhaps with
> ath9k but I am unable to find an issue in our probe/removal.
>
> Could this be an issue with the AMD IOMMU used? Or is it more likely a
> driver issue?
I forgot to mention I'm using l Linus 2.6.29-rc8 with some
serialization patches applied for ath9k (which are unrelated to
DMA/IOMMU/probe) [1].
http://www.kernel.org/pub/linux/kernel/people/mcgrof/patches/ath9k/2009-03-12/serialization-v6/for-2.6.29/
Luis
On Mon, 16 Mar 2009 12:15:37 -0700
"Luis R. Rodriguez" <[email protected]> wrote:
> I've run into "PCI-DMA: Out of IOMMU space" messages after loading and
> unloading a module 30 times. The interesting thing is this only
> happens if I have > 4 GB of memory. The box this occurs has AMD Phenom
> quad core CPU so I take it a harware IOMMU is being used. Below are
> example relevant messages with > 4 GB and then < 4 GB of memory. The
> driver I tested this with was ath9k. It could be an issue perhaps with
> ath9k but I am unable to find an issue in our probe/removal.
>
> Could this be an issue with the AMD IOMMU used? Or is it more likely a
> driver issue?
ath9k wants DMA_32BIT_MASK, right? If so, GART IOMMU does nothing on a
system with < 4GB memory since ath9k can access to all the memory
addresses directly. With >4GB memory, GART needs to remap an address
higher than 4GB because ath9k wants DMA_32BIT_MASK.
>From a quick look, ath9k doesn't call pci_unmap_single for rx
buffers. Though I might be wrong because I don't know anything about
the driver.
=
From: FUJITA Tomonori <[email protected]>
Subject: [PATCH] ath9k: fix dma mapping leak of rx buffer
Signed-off-by: FUJITA Tomonori <[email protected]>
---
drivers/net/wireless/ath9k/recv.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
index 462e08c..cd2a1f6 100644
--- a/drivers/net/wireless/ath9k/recv.c
+++ b/drivers/net/wireless/ath9k/recv.c
@@ -322,8 +322,11 @@ void ath_rx_cleanup(struct ath_softc *sc)
list_for_each_entry(bf, &sc->rx.rxbuf, list) {
skb = bf->bf_mpdu;
- if (skb)
+ if (skb) {
+ pci_unmap_single(sc->pdev, bf->bf_buf_addr,
+ sc->rx.bufsize, PCI_DMA_FROMDEVICE);
dev_kfree_skb(skb);
+ }
}
if (sc->rx.rxdma.dd_desc_len != 0)
--
1.6.0.6
On Mon, Mar 16, 2009 at 5:35 PM, FUJITA Tomonori
<[email protected]> wrote:
> On Mon, 16 Mar 2009 12:15:37 -0700
> "Luis R. Rodriguez" <[email protected]> wrote:
>
>> I've run into "PCI-DMA: Out of IOMMU space" messages after loading and
>> unloading a module 30 times. The interesting thing is this only
>> happens if I have > 4 GB of memory. The box this occurs has AMD Phenom
>> quad core CPU so I take it a harware IOMMU is being used. Below are
>> example relevant messages with > 4 GB and then < 4 GB of memory. The
>> driver I tested this with was ath9k. It could be an issue perhaps with
>> ath9k but I am unable to find an issue in our probe/removal.
>>
>> Could this be an issue with the AMD IOMMU used? Or is it more likely a
>> driver issue?
>
> ath9k wants DMA_32BIT_MASK, right? If so, GART IOMMU does nothing on a
> system with < 4GB memory since ath9k can access to all the memory
> addresses directly. With >4GB memory, GART needs to remap an address
> higher than 4GB because ath9k wants DMA_32BIT_MASK.
>
> From a quick look, ath9k doesn't call pci_unmap_single for rx
> buffers. Though I might be wrong because I don't know anything about
> the driver.
You seem to be right actually, we were calling pci_unmap_single() for
rx buffers on the RX tasklet but never for the simple case of removing
the module. Will test it out in a bit.
Luis
On Mon, Mar 16, 2009 at 6:13 PM, Luis R. Rodriguez <[email protected]> wrote:
> On Mon, Mar 16, 2009 at 5:35 PM, FUJITA Tomonori
> <[email protected]> wrote:
>> On Mon, 16 Mar 2009 12:15:37 -0700
>> "Luis R. Rodriguez" <[email protected]> wrote:
>>
>>> I've run into "PCI-DMA: Out of IOMMU space" messages after loading and
>>> unloading a module 30 times. The interesting thing is this only
>>> happens if I have > 4 GB of memory. The box this occurs has AMD Phenom
>>> quad core CPU so I take it a harware IOMMU is being used. Below are
>>> example relevant messages with > 4 GB and then < 4 GB of memory. The
>>> driver I tested this with was ath9k. It could be an issue perhaps with
>>> ath9k but I am unable to find an issue in our probe/removal.
>>>
>>> Could this be an issue with the AMD IOMMU used? Or is it more likely a
>>> driver issue?
>>
>> ath9k wants DMA_32BIT_MASK, right? If so, GART IOMMU does nothing on a
>> system with < 4GB memory since ath9k can access to all the memory
>> addresses directly. With >4GB memory, GART needs to remap an address
>> higher than 4GB because ath9k wants DMA_32BIT_MASK.
>>
>> From a quick look, ath9k doesn't call pci_unmap_single for rx
>> buffers. Though I might be wrong because I don't know anything about
>> the driver.
>
> You seem to be right actually, we were calling pci_unmap_single() for
> rx buffers on the RX tasklet but never for the simple case of removing
> the module. Will test it out in a bit.
That was it, thanks.. will propagate the patch.
Luis
On Tue, Mar 17, 2009 at 09:35:45AM +0900, FUJITA Tomonori wrote:
> From a quick look, ath9k doesn't call pci_unmap_single for rx
> buffers. Though I might be wrong because I don't know anything about
> the driver.
In any case. This error description sounds very much like a dma memory
leak on module unload. So its very likely a driver issue.
Joerg