From patchwork Wed Aug 12 17:13:33 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Jones X-Patchwork-Id: 31223 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id BD5C8B6F2B for ; Thu, 13 Aug 2009 03:13:44 +1000 (EST) Received: by ozlabs.org (Postfix) id 7D9BFDDD1B; Thu, 13 Aug 2009 03:13:44 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id E10B0DDD0C for ; Thu, 13 Aug 2009 03:13:43 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754028AbZHLRNg (ORCPT ); Wed, 12 Aug 2009 13:13:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751723AbZHLRNf (ORCPT ); Wed, 12 Aug 2009 13:13:35 -0400 Received: from mx2.redhat.com ([66.187.237.31]:33552 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751324AbZHLRNe (ORCPT ); Wed, 12 Aug 2009 13:13:34 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7CHDZ5O000445 for ; Wed, 12 Aug 2009 13:13:35 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n7CHDZ8a028590 for ; Wed, 12 Aug 2009 13:13:35 -0400 Received: from gelk.kernelslacker.org (vpn-12-54.rdu.redhat.com [10.11.12.54]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n7CHDYfP010466 for ; Wed, 12 Aug 2009 13:13:34 -0400 Received: from gelk.kernelslacker.org (localhost [127.0.0.1]) by gelk.kernelslacker.org (8.14.3/8.14.3) with ESMTP id n7CHDXN3007286 for ; Wed, 12 Aug 2009 13:13:33 -0400 Received: (from davej@localhost) by gelk.kernelslacker.org (8.14.3/8.14.3/Submit) id n7CHDXN6007285 for netdev@vger.kernel.org; Wed, 12 Aug 2009 13:13:33 -0400 X-Authentication-Warning: gelk.kernelslacker.org: davej set sender to davej@redhat.com using -f Date: Wed, 12 Aug 2009 13:13:33 -0400 From: Dave Jones To: netdev@vger.kernel.org Subject: Re: 8139cp dma-debug warning. Message-ID: <20090812171333.GD3116@redhat.com> References: <20090806215702.GA17555@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090806215702.GA17555@redhat.com> User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Aug 06, 2009 at 05:57:02PM -0400, Dave Jones wrote: > I'm chasing yet another dma-debug warning where we're unmapping a different > size to what we mapped. > > > WARNING: at lib/dma-debug.c:803 check_unmap+0x1f5/0x509() (Not tainted) > > Hardware name: > > 8139cp 0000:00:03.0: DMA-API: device driver frees DMA memory with different > > size [device address=0x000000001e9f8852] [map size=1536 bytes] [unmap size=1538 > > bytes] > > Modules linked in: ipv6 dm_multipath uinput joydev 8139too virtio_balloon > > 8139cp mii i2c_piix4 virtio_pci i2c_core floppy squashfs pata_acpi ata_generic > > [last unloaded: scsi_wait_scan] > > Pid: 0, comm: swapper Not tainted 2.6.31-0.125.rc5.git2.fc12.i686 #1 > > Call Trace: > > [] warn_slowpath_common+0x7b/0xa3 > > [] ? check_unmap+0x1f5/0x509 > > [] warn_slowpath_fmt+0x34/0x48 > > [] check_unmap+0x1f5/0x509 > > [] ? check_valid_pointer+0x2c/0x6c > > [] debug_dma_unmap_page+0x62/0x7b > > [] dma_unmap_single_attrs.clone.2+0x5a/0x75 [8139cp] > > [] cp_rx_poll+0x147/0x301 [8139cp] > > [] net_rx_action+0xa7/0x1d3 > > [] __do_softirq+0xc8/0x192 > > [] do_softirq+0x49/0x7f > > [] irq_exit+0x48/0x8c > > [] smp_apic_timer_interrupt+0x7a/0x99 > > [] apic_timer_interrupt+0x36/0x3c > > [] ? native_safe_halt+0xa/0xc > > [] default_idle+0x55/0x98 > > [] ? trace_hardirqs_off+0x19/0x2c > > [] cpu_idle+0xac/0xcd > > [] rest_init+0x66/0x79 > > [] start_kernel+0x36f/0x385 > > [] __init_begin+0x7e/0x96 > > ---[ end trace f3c3298e5df24f15 ]--- > > Mapped at: > > [] debug_dma_map_page+0x6b/0x13b > > [] dma_map_single_attrs.clone.1+0x78/0x93 [8139cp] > > [] cp_init_rings+0xaa/0x12c [8139cp] > > [] cp_open+0x84/0x154 [8139cp] > > [] dev_open+0x99/0xe4 > > Looking at 8139cp.c I see this code in cp_rx_poll .. > > 552 buflen = cp->rx_buf_sz + NET_IP_ALIGN; > 553 new_skb = netdev_alloc_skb(dev, buflen); > 554 if (!new_skb) { > 555 dev->stats.rx_dropped++; > 556 goto rx_next; > 557 } > 558 > 559 skb_reserve(new_skb, NET_IP_ALIGN); > > > Aren't we padding the alignment twice here? or am I missing something? > The warning was a difference of two bytes, which is NET_IP_ALIGN, > so I'm wondering if that skb_reserve line needs to be nuked ? There's another instance of the same further in the file. Does this look right? Dave --- 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 diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index 07919d0..065c9c3 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c @@ -556,8 +556,6 @@ rx_status_loop: goto rx_next; } - skb_reserve(new_skb, NET_IP_ALIGN); - dma_unmap_single(&cp->pdev->dev, mapping, buflen, PCI_DMA_FROMDEVICE); @@ -1061,8 +1059,6 @@ static int cp_refill_rx(struct cp_private *cp) if (!skb) goto err_out; - skb_reserve(skb, NET_IP_ALIGN); - mapping = dma_map_single(&cp->pdev->dev, skb->data, cp->rx_buf_sz, PCI_DMA_FROMDEVICE); cp->rx_skb[i] = skb;