Patchwork natsemi: silence dma-debug warnings

login
register
mail settings
Submitter Jim Cromie
Date July 9, 2011, 8:11 p.m.
Message ID <CAJfuBxxKYNvaw5t4jWMP4+hYcw42SkwLiiahVdeezpfh6AsLBA@mail.gmail.com>
Download mbox | patch
Permalink /patch/104015/
State Accepted
Delegated to: David Miller
Headers show

Comments

Jim Cromie - July 9, 2011, 8:11 p.m.
On Sun, Jul 3, 2011 at 11:34 PM, David Miller <davem@davemloft.net> wrote:
> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Date: Mon, 4 Jul 2011 14:30:19 +0900
>
>> This silences dma-debug warnings:
>>
>> https://lkml.org/lkml/2011/6/30/341
>  ...
>> Reported-by: Jim Cromie <jim.cromie@gmail.com>
>> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
>> Tested-by: Jim Cromie <jim.cromie@gmail.com>
>
> Applied, thanks!
>

I have since seen a similar warning on shutdown,
heres a patch for it.

theres one other callsite, but I havent seen the warning from it,
will try to tickle it at some point.
FUJITA Tomonori - July 10, 2011, 1:20 a.m.
On Sat, 9 Jul 2011 14:11:25 -0600
Jim Cromie <jim.cromie@gmail.com> wrote:

> On Sun, Jul 3, 2011 at 11:34 PM, David Miller <davem@davemloft.net> wrote:
>> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
>> Date: Mon, 4 Jul 2011 14:30:19 +0900
>>
>>> This silences dma-debug warnings:
>>>
>>> https://lkml.org/lkml/2011/6/30/341
>>  ...
>>> Reported-by: Jim Cromie <jim.cromie@gmail.com>
>>> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
>>> Tested-by: Jim Cromie <jim.cromie@gmail.com>
>>
>> Applied, thanks!
>>
> 
> I have since seen a similar warning on shutdown,
> heres a patch for it.

Oops, I noticed this too but I forgot to send a patch.

The patch looks good to me.


> theres one other callsite, but I havent seen the warning from it,
> will try to tickle it at some point.

Which pci_unmap_single are you talking about?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jim Cromie - July 10, 2011, 1:45 a.m.
On Sat, Jul 9, 2011 at 7:20 PM, FUJITA Tomonori
<fujita.tomonori@lab.ntt.co.jp> wrote:
> On Sat, 9 Jul 2011 14:11:25 -0600
> Jim Cromie <jim.cromie@gmail.com> wrote:
>
>> On Sun, Jul 3, 2011 at 11:34 PM, David Miller <davem@davemloft.net> wrote:
>>> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
>>> Date: Mon, 4 Jul 2011 14:30:19 +0900
>>>
>>>> This silences dma-debug warnings:
>>>>
>>>> https://lkml.org/lkml/2011/6/30/341
>>>  ...
>>>> Reported-by: Jim Cromie <jim.cromie@gmail.com>
>>>> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
>>>> Tested-by: Jim Cromie <jim.cromie@gmail.com>
>>>
>>> Applied, thanks!
>>>
>>
>> I have since seen a similar warning on shutdown,
>> heres a patch for it.
>
> Oops, I noticed this too but I forgot to send a patch.
>
> The patch looks good to me.
>
>
>> theres one other callsite, but I havent seen the warning from it,
>> will try to tickle it at some point.
>
> Which pci_unmap_single are you talking about?
>


   2131 static void netdev_tx_done(struct net_device *dev)
   2132 {
...
   2160                 pci_unmap_single(np->pci_dev,np->tx_dma[entry],
   2161                                         np->tx_skbuff[entry]->len,
   2162                                         PCI_DMA_TODEVICE);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
FUJITA Tomonori - July 10, 2011, 1:57 a.m.
On Sat, 9 Jul 2011 19:45:22 -0600
Jim Cromie <jim.cromie@gmail.com> wrote:

> On Sat, Jul 9, 2011 at 7:20 PM, FUJITA Tomonori
> <fujita.tomonori@lab.ntt.co.jp> wrote:
>> On Sat, 9 Jul 2011 14:11:25 -0600
>> Jim Cromie <jim.cromie@gmail.com> wrote:
>>
>>> On Sun, Jul 3, 2011 at 11:34 PM, David Miller <davem@davemloft.net> wrote:
>>>> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
>>>> Date: Mon, 4 Jul 2011 14:30:19 +0900
>>>>
>>>>> This silences dma-debug warnings:
>>>>>
>>>>> https://lkml.org/lkml/2011/6/30/341
>>>>  ...
>>>>> Reported-by: Jim Cromie <jim.cromie@gmail.com>
>>>>> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
>>>>> Tested-by: Jim Cromie <jim.cromie@gmail.com>
>>>>
>>>> Applied, thanks!
>>>>
>>>
>>> I have since seen a similar warning on shutdown,
>>> heres a patch for it.
>>
>> Oops, I noticed this too but I forgot to send a patch.
>>
>> The patch looks good to me.
>>
>>
>>> theres one other callsite, but I havent seen the warning from it,
>>> will try to tickle it at some point.
>>
>> Which pci_unmap_single are you talking about?
>>
> 
> 
>    2131 static void netdev_tx_done(struct net_device *dev)
>    2132 {
> ...
>    2160                 pci_unmap_single(np->pci_dev,np->tx_dma[entry],
>    2161                                         np->tx_skbuff[entry]->len,
>    2162                                         PCI_DMA_TODEVICE);

It's pci_unmap_single call for tx_dma buffers. We fixed
pci_unmap_single calls for rx_dma buffers.

Looks like the driver correctlly uses pci_map_single and
pci_unmap_single for tx_dma buffers.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
=?ISO-8859-2?Q?Micha=B3_Miros=B3aw?= - July 10, 2011, 8:58 a.m.
2011/7/9 Jim Cromie <jim.cromie@gmail.com>:
> On Sun, Jul 3, 2011 at 11:34 PM, David Miller <davem@davemloft.net> wrote:
>> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
>> Date: Mon, 4 Jul 2011 14:30:19 +0900
>>
>>> This silences dma-debug warnings:
>>>
>>> https://lkml.org/lkml/2011/6/30/341
>>  ...
>>> Reported-by: Jim Cromie <jim.cromie@gmail.com>
>>> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
>>> Tested-by: Jim Cromie <jim.cromie@gmail.com>
>>
>> Applied, thanks!
>>
>
> I have since seen a similar warning on shutdown,
> heres a patch for it.
>
> theres one other callsite, but I havent seen the warning from it,
> will try to tickle it at some point.

[about attached patch]

Why not increase buflen, like in refill_rx()?

Best Regards,
Michał Mirosław
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - July 10, 2011, 2:07 p.m.
From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Date: Sun, 10 Jul 2011 10:20:39 +0900 (JST)

> On Sat, 9 Jul 2011 14:11:25 -0600
> Jim Cromie <jim.cromie@gmail.com> wrote:
> 
>> On Sun, Jul 3, 2011 at 11:34 PM, David Miller <davem@davemloft.net> wrote:
>>> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
>>> Date: Mon, 4 Jul 2011 14:30:19 +0900
>>>
>>>> This silences dma-debug warnings:
>>>>
>>>> https://lkml.org/lkml/2011/6/30/341
>>>  ...
>>>> Reported-by: Jim Cromie <jim.cromie@gmail.com>
>>>> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
>>>> Tested-by: Jim Cromie <jim.cromie@gmail.com>
>>>
>>> Applied, thanks!
>>>
>> 
>> I have since seen a similar warning on shutdown,
>> heres a patch for it.
> 
> Oops, I noticed this too but I forgot to send a patch.
> 
> The patch looks good to me.

I'll apply this, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

From 2d81b28645b22100271bdbe2d6859cb49a49166d Mon Sep 17 00:00:00 2001
From: Jim Cromie <jim.cromie@gmail.com>
Date: Sat, 9 Jul 2011 11:44:38 -0600
Subject: [PATCH 1/3] natsemi: fix another dma-debug report

commit 2fb83cd618be34546fb526a9051eceaa95517026
Author: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Date:   Sun Jul 3 22:34:29 2011 -0700

Above commit fixed previously reported warning, but I later
noticed another one at shutdown.  This commit fixes it.

Theres one other callsite to pci_unmap_single, but I havent seen
it report a problem, so havent included it here.

------------[ cut here ]------------
WARNING: at /home/jimc/projects/lx/linux-2.6/lib/dma-debug.c:820 check_unmap+0x1fe/0x56c()
natsemi 0000:00:06.0: DMA-API: device driver frees DMA memory with different size [device address=0x0000000007356840] [map size=1538 bytes] [unmap size=1522 bytes]
Modules linked in: bridge stp llc x_tables ipv6 pc87360 hwmon_vid scx200_hrt pc8736x_gpio scx200_gpio nsc_gpio scx200_acb i2c_core arc4 rtl8180 mac80211 eeprom_93cx6 cfg80211 pcspkr scx200 rfkill ide_gd_mod ide_pci_generic ohci_hcd usbcore sc1200 ide_core [last unloaded: ebtables]
Pid: 3996, comm: ifconfig Not tainted 3.0.0-rc6-skc-dyndbg+ #104
Call Trace:
 [<c011ca97>] warn_slowpath_common+0x4a/0x5f
 [<c0261ca5>] ? check_unmap+0x1fe/0x56c
 [<c011cb10>] warn_slowpath_fmt+0x26/0x2a
 [<c0261ca5>] check_unmap+0x1fe/0x56c
 [<c0116505>] ? check_preempt_curr+0x5a/0x6a
 [<c0262186>] debug_dma_unmap_page+0x53/0x5b
 [<c02aaaf9>] pci_unmap_single+0x4d/0x57
 [<c02aab51>] drain_rx+0x4e/0x74
 [<c02acc6e>] netdev_close+0x103/0x1b8
 [<c02f097e>] ? spin_unlock_bh.clone.30+0x12/0x14
 [<c02f10aa>] ? dev_deactivate_many+0xc1/0xef
 [<c02e05e9>] __dev_close_many+0x69/0x86
 [<c02e0625>] __dev_close+0x1f/0x2c
 [<c02e3200>] __dev_change_flags+0x92/0x107
 [<c02e32db>] dev_change_flags+0x13/0x3f
 [<c031e7ea>] devinet_ioctl+0x248/0x4b3
 [<c02e3a9e>] ? dev_ioctl+0x50a/0x54c
 [<c031f509>] inet_ioctl+0x8e/0xa7
 [<c02d506f>] sock_ioctl+0x1b6/0x1da
 [<c02d4eb9>] ? sock_fasync+0x61/0x61
 [<c0183db4>] do_vfs_ioctl+0x44d/0x47f
 [<c0113cdb>] ? do_page_fault+0x268/0x299
 [<c01339d0>] ? __put_cred+0x34/0x36
 [<c0177d83>] ? sys_faccessat+0x13e/0x14b
 [<c0183e14>] sys_ioctl+0x2e/0x4a
 [<c035bc95>] syscall_call+0x7/0xb
---[ end trace 7013a1bdac403e56 ]---

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 drivers/net/natsemi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 8f8b65a..e4bd202 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -2028,8 +2028,8 @@  static void drain_rx(struct net_device *dev)
 		np->rx_ring[i].cmd_status = 0;
 		np->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */
 		if (np->rx_skbuff[i]) {
-			pci_unmap_single(np->pci_dev,
-				np->rx_dma[i], buflen,
+			pci_unmap_single(np->pci_dev, np->rx_dma[i],
+				buflen + NATSEMI_PADDING,
 				PCI_DMA_FROMDEVICE);
 			dev_kfree_skb(np->rx_skbuff[i]);
 		}
-- 
1.7.4.1