From patchwork Tue Jun 16 16:33:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Brandeburg X-Patchwork-Id: 28734 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 DE47AB710D for ; Wed, 17 Jun 2009 02:33:25 +1000 (EST) Received: by ozlabs.org (Postfix) id D1ABBDDDA0; Wed, 17 Jun 2009 02:33:25 +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 6F4D6DDD04 for ; Wed, 17 Jun 2009 02:33:25 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758700AbZFPQdO (ORCPT ); Tue, 16 Jun 2009 12:33:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757194AbZFPQdO (ORCPT ); Tue, 16 Jun 2009 12:33:14 -0400 Received: from mga11.intel.com ([192.55.52.93]:64045 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754763AbZFPQdN (ORCPT ); Tue, 16 Jun 2009 12:33:13 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 16 Jun 2009 09:25:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.42,229,1243839600"; d="scan'208";a="699899071" Received: from plxs0284.pdx.intel.com ([10.7.76.148]) by fmsmga001.fm.intel.com with ESMTP; 16 Jun 2009 09:36:40 -0700 Received: from jbrandeb-desk1.amr.corp.intel.com (jbrandeb-desk1.amr.corp.intel.com [134.134.3.173]) by plxs0284.pdx.intel.com (8.12.11.20060308/8.12.10/MailSET/Hub) with ESMTP id n5GGXFFR028391; Tue, 16 Jun 2009 09:33:15 -0700 Date: Tue, 16 Jun 2009 09:33:15 -0700 (Pacific Daylight Time) From: "Brandeburg, Jesse" To: Joerg Roedel cc: "e1000-devel@lists.sourceforge.net" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: dma-debug warning with ixgbe In-Reply-To: <20090616153417.GN5139@amd.com> Message-ID: References: <20090616153417.GN5139@amd.com> User-Agent: Alpine 2.00 (WNT 1167 2008-08-23) ReplyTo: "Brandeburg, Jesse" X-X-Sender: amrjbrandeb@imapmail.glb.intel.com MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, 16 Jun 2009, Joerg Roedel wrote: > 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. > ------------[ 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 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 in 2.6.30, so is a candidate for -stable. Signed-off-by: Jesse Brandeburg CC: Joerg Roedel --- drivers/net/ixgbe/ixgbe_main.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) -- 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/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index a551a96..01c2193 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c @@ -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