From patchwork Wed Jan 20 09:41:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarek Poplawski X-Patchwork-Id: 43266 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1BF64B7C98 for ; Wed, 20 Jan 2010 20:41:46 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752489Ab0ATJlQ (ORCPT ); Wed, 20 Jan 2010 04:41:16 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752280Ab0ATJlQ (ORCPT ); Wed, 20 Jan 2010 04:41:16 -0500 Received: from fg-out-1718.google.com ([72.14.220.153]:62637 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752010Ab0ATJlL (ORCPT ); Wed, 20 Jan 2010 04:41:11 -0500 Received: by fg-out-1718.google.com with SMTP id 16so808320fgg.1 for ; Wed, 20 Jan 2010 01:41:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=MRnhyZg68jHps2e6U10ddIto4GqzdAGn3xGNBYNP+XU=; b=WXH95cDX3/PLF0l0AumKdRCNg4/gcBPx6RuvaKaA/mTHefI16IZYZEVPHupkcWOV// 2QfmtkH9xfb+esawj6VQhhYL71nvtsfx7i4rXI4d31xCPhB712bOhIhYfaiOkDCrt3YJ 1Ie5p3BIC5E5+R4GoOHuUowTQkU0D1cibfYqY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=CqjC+4MAbqPFa+xSETBT/rM3mt8kVj/gmql23q2SxN++zACRh4GfGXbyoUcdzg1dMk WrLqzlCxpqsjrvVRaGuaue0QIm2siSjaPWKsL6C67Ur/JF+IVRe959grDwP3n9MewHf+ vP/3j5L4s13ppviLeHwBdvahb8Rw39BQQLMQs= Received: by 10.87.46.34 with SMTP id y34mr7667517fgj.60.1263980468412; Wed, 20 Jan 2010 01:41:08 -0800 (PST) Received: from ff.dom.local (bv170.internetdsl.tpnet.pl [80.53.205.170]) by mx.google.com with ESMTPS id e11sm18717404fga.4.2010.01.20.01.41.05 (version=SSLv3 cipher=RC4-MD5); Wed, 20 Jan 2010 01:41:07 -0800 (PST) Date: Wed, 20 Jan 2010 09:41:03 +0000 From: Jarek Poplawski To: David Miller Cc: Stephen Hemminger , Michael Breuer , akpm@linux-foundation.org, flyboy@gmail.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Michael Chan , Don Fry , Francois Romieu , Matt Carlson Subject: [PATCH] sky2: Fix WARNING: at lib/dma-debug.c:902 check_sync Message-ID: <20100120094103.GA6225@ff.dom.local> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org [ previously: Re: [PATCH] af_packet: Don't use skb after dev_queue_xmit() ] On Tue, Jan 19, 2010 at 05:10:13PM -0800, Stephen Hemminger wrote: > On Tue, 19 Jan 2010 20:01:10 -0500 > Michael Breuer wrote: > > > On 1/19/2010 5:45 PM, Jarek Poplawski wrote: > > > On Tue, Jan 19, 2010 at 03:06:01PM -0500, Michael Breuer wrote: > > > > > >> On 1/19/2010 2:59 PM, Jarek Poplawski wrote: > > >> > > >>> On Tue, Jan 19, 2010 at 10:47:27AM -0500, Michael Breuer wrote: > > >>> ... > > >>> > > >>>> Still get the warning... but now 60 bytes. > > >>>> Jan 19 10:43:50 mail kernel: ------------[ cut here ]------------ > > >>>> Jan 19 10:43:50 mail kernel: WARNING: at lib/dma-debug.c:902 ... > > That not only compiled, but it cleared the error as well. Additionally, > > I used to see a bit of a delay receiving the login prompt when first > > connecting to the box by ssh. That delay is gone with this patch. I'd > > guess that the warning wasn't quite as innocuous as I thought. > > Note: tested on 2.6.32.4. I'll leave this up for a bit before > > attempting to move back to head. > > Seems like an underlying bug in the DMA api. Maybe it just can't > handle operations on partial mapping. > > Other drivers with same problem: > bnx2, cassini, pcnet32, r8169, rrunner, skge, sungem, tg3, It seems using the same length (even without pci_unmap_len()) is crucial here, but I hope maintainers (added to CC) will take care. Btw, it's not tested yet, but it might affect CONFIG_DMAR problems. Thanks, Jarek P. -----------------------> Using pci_unmap_len(), with the same length as pci_map_single(), with pci_dma_sync_single_for_cpu()/_device() fixes this warning (2.6.32.4): > Jan 19 10:43:50 mail kernel: WARNING: at lib/dma-debug.c:902 > check_sync+0xc1/0x43f() > Jan 19 10:43:50 mail kernel: Hardware name: System Product Name > Jan 19 10:43:50 mail kernel: sky2 0000:04:00.0: DMA-API: device driver > tries to sync DMA memory it has not allocated [device > address=0x0000000320a0b022] [size=60 bytes] Reported-by: Michael Breuer Tested-by: Michael Breuer Signed-off-by: Jarek Poplawski --- drivers/net/sky2.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 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/sky2.c b/drivers/net/sky2.c index 7650f73..cdebdd3 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -2252,12 +2252,14 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2, skb = netdev_alloc_skb_ip_align(sky2->netdev, length); if (likely(skb)) { pci_dma_sync_single_for_cpu(sky2->hw->pdev, re->data_addr, - length, PCI_DMA_FROMDEVICE); + pci_unmap_len(re, data_size), + PCI_DMA_FROMDEVICE); skb_copy_from_linear_data(re->skb, skb->data, length); skb->ip_summed = re->skb->ip_summed; skb->csum = re->skb->csum; pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, - length, PCI_DMA_FROMDEVICE); + pci_unmap_len(re, data_size), + PCI_DMA_FROMDEVICE); re->skb->ip_summed = CHECKSUM_NONE; skb_put(skb, length); }