mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* 8139cp WARNING: at lib/dma-debug.c:803 check_unmap+0x41a/0x650()
@ 2009-08-11 13:21 Zdenek Kabelac
  2009-08-11 19:46 ` [PATCH] 8139cp : balance dma_map_single vs dma_unmap_single pair Francois Romieu
  0 siblings, 1 reply; 3+ messages in thread
From: Zdenek Kabelac @ 2009-08-11 13:21 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: jgarzik, davem

Hi

I'm getting this warning message from my kvm machine (created with
this network card -net nic,model=rtl8139)

WARNING: at lib/dma-debug.c:803 check_unmap+0x41a/0x650()

Hardware name:

8139cp 0000:00:03.0: DMA-API: device driver frees DMA memory with
different size [device address=0x000000001ebda0b2] [map size=1536
bytes] [unmap size=1538 bytes]

Modules linked in: dm_crypt crypto_blkcipher crypto_algapi loop
virtio_balloon uhci_hcd ehci_hcd dm_mod psmouse i2c_piix4 8139cp evdev
virtio_pci virtio_ring serio_raw virtio mii i2c_core usbcore rtc_cmos
rtc_core rtc_lib floppy button

Pid: 0, comm: swapper Not tainted 2.6.31-rc5-00472-g3d32107 #4

Call Trace:

 <IRQ>  [<ffffffff8104c4fb>] warn_slowpath_common+0x7b/0xc0

 [<ffffffff8104c5a1>] warn_slowpath_fmt+0x41/0x50

 [<ffffffff811e881a>] check_unmap+0x41a/0x650

 [<ffffffff8107accc>] ? trace_hardirqs_on_caller+0x7c/0x1a0

 [<ffffffff811e8ca9>] debug_dma_unmap_page+0x59/0x60

 [<ffffffffa0096ce1>] cp_rx_poll+0x301/0x550 [8139cp]

 [<ffffffff812f9050>] net_rx_action+0x170/0x270

 [<ffffffff812f8fce>] ? net_rx_action+0xee/0x270

 [<ffffffff81052e7c>] __do_softirq+0xbc/0x200

 [<ffffffff8100d2dc>] call_softirq+0x1c/0x50

 [<ffffffff8100eb65>] do_softirq+0x75/0xb0

 [<ffffffff81052935>] irq_exit+0x95/0xa0

 [<ffffffff81386001>] smp_apic_timer_interrupt+0x71/0x9c

 [<ffffffff8100ccb3>] apic_timer_interrupt+0x13/0x20

 <EOI>  [<ffffffff81014513>] ? default_idle+0x53/0xe0

 [<ffffffff81014511>] ? default_idle+0x51/0xe0

 [<ffffffff8100ae80>] ? cpu_idle+0x70/0xc0

 [<ffffffff81379eea>] ? start_secondary+0x189/0x18e

---[ end trace d222049dbdb8d58c ]---

Mapped at:

 [<ffffffff811e98a6>] debug_dma_map_page+0x86/0x170

 [<ffffffffa00965d7>] cp_init_rings+0x167/0x230 [8139cp]

 [<ffffffffa009689d>] cp_open+0xdd/0x220 [8139cp]

 [<ffffffff812f81b1>] dev_open+0xa1/0x100

 [<ffffffff812f7fe6>] dev_change_flags+0x96/0x1c0

NET: Registered protocol family 10



Zdenek

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

* [PATCH] 8139cp : balance dma_map_single vs dma_unmap_single pair
  2009-08-11 13:21 8139cp WARNING: at lib/dma-debug.c:803 check_unmap+0x41a/0x650() Zdenek Kabelac
@ 2009-08-11 19:46 ` Francois Romieu
  2009-08-13  5:19   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Francois Romieu @ 2009-08-11 19:46 UTC (permalink / raw)
  To: Zdenek Kabelac; +Cc: Linux Kernel Mailing List, jgarzik, davem

The driver always:
1. allocate cp->rx_buf_sz + NET_IP_ALIGN
2. map cp->rx_buf_sz

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
 drivers/net/8139cp.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 07919d0..4a8995a 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -515,7 +515,7 @@ rx_status_loop:
 		dma_addr_t mapping;
 		struct sk_buff *skb, *new_skb;
 		struct cp_desc *desc;
-		unsigned buflen;
+		const unsigned buflen = cp->rx_buf_sz;
 
 		skb = cp->rx_skb[rx_tail];
 		BUG_ON(!skb);
@@ -549,8 +549,7 @@ rx_status_loop:
 			pr_debug("%s: rx slot %d status 0x%x len %d\n",
 			       dev->name, rx_tail, status, len);
 
-		buflen = cp->rx_buf_sz + NET_IP_ALIGN;
-		new_skb = netdev_alloc_skb(dev, buflen);
+		new_skb = netdev_alloc_skb(dev, buflen + NET_IP_ALIGN);
 		if (!new_skb) {
 			dev->stats.rx_dropped++;
 			goto rx_next;
-- 
1.6.2.5


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

* Re: [PATCH] 8139cp : balance dma_map_single vs dma_unmap_single pair
  2009-08-11 19:46 ` [PATCH] 8139cp : balance dma_map_single vs dma_unmap_single pair Francois Romieu
@ 2009-08-13  5:19   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2009-08-13  5:19 UTC (permalink / raw)
  To: romieu; +Cc: zdenek.kabelac, linux-kernel, jgarzik

From: Francois Romieu <romieu@fr.zoreil.com>
Date: Tue, 11 Aug 2009 21:46:22 +0200

> The driver always:
> 1. allocate cp->rx_buf_sz + NET_IP_ALIGN
> 2. map cp->rx_buf_sz
> 
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

Applied, thanks Francois!

But...

1) I don't expect upstream patches in my work email inbox.

2) Please send networking patches to netdev@vger.kernel.org,
   and if you do that then getting #1 right isn't so critical
   :-)

Thanks again!

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

end of thread, other threads:[~2009-08-13  5:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-11 13:21 8139cp WARNING: at lib/dma-debug.c:803 check_unmap+0x41a/0x650() Zdenek Kabelac
2009-08-11 19:46 ` [PATCH] 8139cp : balance dma_map_single vs dma_unmap_single pair Francois Romieu
2009-08-13  5:19   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®