Skip to contentSkip to conversation

dma-debug warning with ixgbe

DISCUSSION Joerg Roedel 2 participants 3 messages Jun 16, 2009 – Jun 17, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

today I got this dma-debug warning with the ixgbe driver with a kernel near 2.6.30-rc8.

------------[ 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]
Modules linked in: loop i2c_piix4 tpm_infineon rtc_cmos tpm
tpm_bios rtc_core rtc_lib button ata_generic pata_acpi usbhid
pata_atiixp ixgbe hid dca bnx2
Pid: 4391, comm: ifconfig Not tainted 2.6.30-rc81 #1
Call Trace:
 [<ffffffff8039125a>] ? check_unmap+0x214/0x5c3
 [<ffffffff80238d72>] warn_slowpath_common+0x77/0xa4
 [<ffffffff80238e14>] warn_slowpath_fmt+0x64/0x66
 [<ffffffff80391134>] ? check_unmap+0xee/0x5c3
 [<ffffffff8058970b>] ? _spin_lock_irqsave+0x3f/0x4b
 [<ffffffff80391134>] ? check_unmap+0xee/0x5c3
 [<ffffffff8039125a>] check_unmap+0x214/0x5c3
 [<ffffffff80391813>] debug_dma_unmap_page+0x51/0x53
 [<ffffffffa002e29c>] ixgbe_clean_rx_ring+0xb9/0x1e4 [ixgbe]
 [<ffffffffa002f2f6>] ixgbe_down+0x2f8/0x34e [ixgbe]
 [<ffffffffa00307a8>] ixgbe_reinit_locked+0x59/0x70 [ixgbe]
 [<ffffffffa0030837>] ixgbe_change_mtu+0x78/0x82 [ixgbe]
 [<ffffffff804f56b5>] dev_set_mtu+0x3a/0x69
 [<ffffffff804f688c>] dev_ifsioc+0xcf/0x2cc
 [<ffffffff804f7018>] dev_ioctl+0x58f/0x647
 [<ffffffff80351978>] ? avc_has_perm+0x4e/0x60
 [<ffffffff804e4e7f>] sock_ioctl+0x21f/0x231
 [<ffffffff802cb478>] vfs_ioctl+0x2a/0x78
 [<ffffffff802cb934>] do_vfs_ioctl+0x46e/0x4aa
 [<ffffffff80250521>] ? up_read+0x26/0x2b
 [<ffffffff802cb9c5>] sys_ioctl+0x55/0x77
 [<ffffffff8020afab>] system_call_fastpath+0x16/0x1b
---[ end trace f560e4a00a9d5d32 ]---
Mapped at:
 [<ffffffff80391bca>] debug_dma_map_page+0x7c/0x11f
 [<ffffffffa002b3ba>] ixgbe_alloc_rx_buffers+0x247/0x316 [ixgbe]
 [<ffffffffa002bc5a>] ixgbe_configure+0x7d1/0x7e3 [ixgbe]
 [<ffffffffa002ffb9>] ixgbe_open+0xed/0x63b [ixgbe]
 [<ffffffff804f5d48>] dev_open+0x7c/0xc2

Joerg

Signature · 6 lines
           | Advanced Micro Devices GmbH
 Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei München
 System    | 
 Research  | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
 Center    | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
           | Registergericht München, HRB Nr. 43632
#1 lore raw
Quoted 2 lines · Joerg Roedel

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.

Quoted 7 lines
------------[ 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 <[email protected]>

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 <[email protected]> in 2.6.30, so is a candidate for -stable.

---

 drivers/net/ixgbe/ixgbe_main.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +5 -3
index a551a96..01c2193 100644
@@ -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

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects

#2 lore raw
Quoted 15 lines · Jesse
Quoted 2 lines · Joerg Roedel

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.

Quoted 7 lines
------------[ 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]

Quoted 2 lines

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

Thanks for the quick answer :) But I tested the patch and the warning is still there.

Joerg

Signature · 6 lines
           | Advanced Micro Devices GmbH
 Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei München
 System    | 
 Research  | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
 Center    | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
           | Registergericht München, HRB Nr. 43632