Re: dma-debug warning with ixgbe

From: Brandeburg, Jesse
Date: Tue Jun 16 2009 - 12:33:27 EST


On Tue, 16 Jun 2009, Joerg Roedel wrote:
> today I got this dma-debug warning with the ixgbe driver with a kernel
> near 2.6.30-rc8.

Hi Joerg, thanks for the report, I thought we had fixed all of these
already but we must have missed this one.

> ------------[ cut here ]------------
> WARNING: at /data/repos/linux-2.6-iommu/lib/dma-debug.c:806
> check_unmap+0x214/0x5c3()
> Hardware name: Toonie
> ixgbe 0000:02:00.0: DMA-API: device driver frees DMA memory with
> different size [device address=0x0000000000045c12] [map size=258
> bytes] [unmap size=256 bytes]

The following patch should fix it, compile tested only, but it is pretty
straight forward.

---

ixgbe: fix map length bug

From: Jesse Brandeburg <jesse.brandeburg@xxxxxxxxx>

ixgbe is mapping more than it unmaps, reduce the length of the map call and
remove the "used once" local variable.

found by Joerg Roedel <joerg.roedel@xxxxxxx> in 2.6.30, so is a candidate for
-stable.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@xxxxxxxxx>
CC: Joerg Roedel <joerg.roedel@xxxxxxx>
---

drivers/net/ixgbe/ixgbe_main.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)


diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index a551a96..01c2193 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -563,7 +563,6 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter,
union ixgbe_adv_rx_desc *rx_desc;
struct ixgbe_rx_buffer *bi;
unsigned int i;
- unsigned int bufsz = rx_ring->rx_buf_len + NET_IP_ALIGN;

i = rx_ring->next_to_use;
bi = &rx_ring->rx_buffer_info[i];
@@ -593,7 +592,9 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter,

if (!bi->skb) {
struct sk_buff *skb;
- skb = netdev_alloc_skb(adapter->netdev, bufsz);
+ skb = netdev_alloc_skb(adapter->netdev,
+ (rx_ring->rx_buf_len +
+ NET_IP_ALIGN));

if (!skb) {
adapter->alloc_rx_buff_failed++;
@@ -608,7 +609,8 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter,
skb_reserve(skb, NET_IP_ALIGN);

bi->skb = skb;
- bi->dma = pci_map_single(pdev, skb->data, bufsz,
+ bi->dma = pci_map_single(pdev, skb->data,
+ rx_ring->rx_buf_len,
PCI_DMA_FROMDEVICE);
}
/* Refresh the desc even if buffer_addrs didn't change because
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/