Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Joerg Roedel <joerg.roedel <at> amd.com>
Subject: [PATCH 0/10] DMA-API debugging facility
Newsgroups: gmane.linux.kernel
Date: Friday 21st November 2008 16:26:00 UTC (over 7 years ago)
Hi,

this patchset introduces code to debug drivers usage of the DMA-API.
Tests with hardware IOMMUs have shown several bugs in drivers regarding
the usage of that API.
Problems were found especially in network card drivers.

These bugs often don't show up or have any negative impact if there is
no hardware IOMMU in use in the system. But with an hardware IOMMU these
bugs turn the hardware unusable or, in the worst case, cause data
corruption on devices which are managed by other (good) drivers.

With the code these patches introduce driver developers can find several
bugs of misusing the DMA-API in their drivers. But be aware, it can not
find all possible bugs. If it finds a problem it prints out messages
like

tg3 0000:08:04.0: PCI-DMA: device driver tries to free DMA memory it has
not allocated [device address=0x000000042f0f3ae7] [size=48 bytes]
Pid: 6285, comm: bash Not tainted 2.6.28-rc5-00176-g6ae6379-dirty #6
Call Trace:
   [] check_unmap+0x52/0x1ce
 [] debug_unmap_single+0x61/0xa4
 [] skb_dma_unmap+0xf2/0x10c
 [] tg3_poll+0xe8/0x822
 [] mix_pool_bytes_extract+0x5c/0x155
 [] net_rx_action+0x9d/0x170
 [] __do_softirq+0x7a/0x13d
 [] call_softirq+0x1c/0x28
 [] do_softirq+0x2c/0x68
 [] irq_exit+0x3f/0x85
 [] do_IRQ+0x14d/0x16f
 [] ret_from_intr+0x0/0xa
   [] memcmp+0xb/0x22
 [] __d_lookup+0xb9/0xf9
 [] do_lookup+0x2a/0x1c1
 [] __link_path_walk+0x331/0xc0d
 [] path_walk+0x46/0x8b
 [] do_path_lookup+0xff/0x121
 [] path_lookup_open+0x54/0x95
 [] do_filp_open+0x9d/0x782
 [] alloc_fd+0x69/0x10c
 [] do_sys_open+0x48/0xcc
 [] system_call_fastpath+0x16/0x1b

or (from another machine with AMD IOMMU):

ixgbe 0000:02:00.0: PCI-DMA: device driver frees DMA memory with different
size [device address=0x0000000003fed812] [map size=258 bytes] [unmap
size=256 bytes]
Pid: 6178, comm: rmmod Not tainted 2.6.28-rc5 #4
Call Trace:
 [] iommu_queue_inv_iommu_pages+0x5e/0x70
 [] check_unmap+0x1c6/0x240
 [] debug_unmap_single+0xb5/0x110
 [] ixgbe_clean_rx_ring+0x147/0x220
 [] ixgbe_down+0x2fd/0x3d0 [ixgbe]
 [] ixgbe_close+0x13/0xc0 [ixgbe]
 [] dev_close+0x56/0xa0
 [] rollback_registered+0x43/0x220
 [] unregister_netdevice+0x15/0x60
 [] unregister_netdev+0x11/0x20
 [] ixgbe_remove+0x48/0x16e [ixgbe]
 [] pci_device_remove+0x2c/0x60
 [] __device_release_driver+0x99/0x100
 [] driver_detach+0xb8/0xc0
 [] bus_remove_driver+0x8e/0xd0
 [] pci_unregister_driver+0x34/0x90
 [] sys_delete_module+0x1c7/0x2a0
 [] do_munmap+0x349/0x390
 [] __up_write+0x21/0x150
 [] system_call_fastpath+0x16/0x1b

This way driver developers get an idea where the problem is in their
code.

Please review and send any objections or, if there are none, consider
for inclusion ;)

Thanks,

Joerg



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
 
CD: 3ms