From patchwork Thu Apr 14 15:39:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8838881 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B8EB6C0553 for ; Thu, 14 Apr 2016 15:42:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CBD65202EB for ; Thu, 14 Apr 2016 15:42:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DC7C620295 for ; Thu, 14 Apr 2016 15:42:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aqjNk-00025F-To; Thu, 14 Apr 2016 15:40:37 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aqjMe-0008Qp-JZ for linux-arm-kernel@bombadil.infradead.org; Thu, 14 Apr 2016 15:39:28 +0000 Received: from mail-pf0-x22d.google.com ([2607:f8b0:400e:c00::22d]) by merlin.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1aqjMc-0001aP-Ks for linux-arm-kernel@lists.infradead.org; Thu, 14 Apr 2016 15:39:27 +0000 Received: by mail-pf0-x22d.google.com with SMTP id 184so47246955pff.0 for ; Thu, 14 Apr 2016 08:39:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=boundarydevices-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=UcIdvMrvPFEkfUxzwMja8qQ/jT/9IygnTBn697larMk=; b=sOpcoW3G5NgYRot3+2/x1J8NIekxjNaCIILr8FVxiiPiAVdlEeGsMX1ilUt7srsGkv BcjHm2UVvbKWHWVY9iUFdyWy9peg/ay9T/hVlTwDFOj99QhdvcihIR6zXO87IFwN81Md ESmUCys6Wu1Zrr8FRqMuP4P9617JO0iVmRnIEg8FPIpqNqLn9sdYiFBxWPYjhvkU3cUk yxz6hpNXvpyLJEQM5JJ3Ah4UdKiFfqai9dPYb9iJu3d1IzHk8MLaACan5mZ49MlrmKFX IBUHLfOOMmtNJTcBjOMruLHZ2PZKIOLvcH/4C7eBcOJ50fzcCnTbZDZx5VsqAlUikILm UtTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=UcIdvMrvPFEkfUxzwMja8qQ/jT/9IygnTBn697larMk=; b=D2DHnLtT8iJhm7BpU6UDXESGQvaagFVmVMKV2AsF7cX38po1jhof5qvy61SUtP85Fr FtxG+SixrO12cjMmWBpiRigrHbnUTI7EXeZhhSx1PiuKgdDtTfG+l4f14mb/EdgopWEd zu0HjVswDidyK/aGNT2Htyxx1dJF3I5ealeotRgqb9Xcy/QpiwESzNFXW76QoUGqrC4m FDFpid8dXtvLkxRCD6eaDgj+wQLMEDM1qZhOemQyuPCSzDL67pauKJCdxwOJgn+bJCAP UFGmT/YkLhaPbaMvqeITnMsQ2BbFRVQrMz6KuUXAYtzBcSYbCMmTPIiK4gC1fX2vGIwM mOVQ== X-Gm-Message-State: AOPr4FUxVU8RizRRDtxSQsLMy6pggwMZTf5OF9CqcgcmrT5VfqMYK+ZSv31Oq7WMTi6TUQ== X-Received: by 10.98.76.22 with SMTP id z22mr21825089pfa.78.1460648344624; Thu, 14 Apr 2016 08:39:04 -0700 (PDT) Received: from [192.168.0.242] (wsip-70-184-93-199.ph.ph.cox.net. [70.184.93.199]) by smtp.googlemail.com with ESMTPSA id 85sm244357pfs.34.2016.04.14.08.39.02 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Apr 2016 08:39:03 -0700 (PDT) Subject: Re: [PATCH net-next V3 00/16] net: fec: cleanup and fixes To: Holger Schurig References: <1459909562-22865-1-git-send-email-troy.kisky@boundarydevices.com> <87h9f4ebvp.fsf@gmail.com> From: Troy Kisky Message-ID: <570FB998.2080900@boundarydevices.com> Date: Thu, 14 Apr 2016 08:39:04 -0700 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <87h9f4ebvp.fsf@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160414_113926_819566_4C6F31D7 X-CRM114-Status: GOOD ( 15.93 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, stillcompiling@gmail.com, fugang.duan@nxp.com, sergei.shtylyov@cogentembedded.com, arnd@arndb.de, netdev@vger.kernel.org, fabio.estevam@nxp.com, gerg@uclinux.org, lznuaa@gmail.com, johannes@sipsolutions.net, tremyfr@gmail.com, davem@davemloft.net, linux-arm-kernel@lists.infradead.org, l.stach@pengutronix.de Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 4/14/2016 3:13 AM, Holger Schurig wrote: > Do you guys that work with the FEC driver ever run with > CONFIG_DMA_API_DEBUG enabled? > > I ask this Because I get this error when it's turned on when I do some > "rsync" transfer to my device: > > [ 58.420980] ------------[ cut here ]------------ > [ 58.425667] WARNING: CPU: 0 PID: 377 at /home/schurig/d/mkarm/linux-4.5/lib/dma-debug.c:1096 check_unmap+0x9d0/0xab8() > [ 58.436405] fec 2188000.ethernet: DMA-API: device driver tries to free DMA memory it has not allocated [device address=0x0000000000000000] [size=66 bytes] > [ 58.450248] Modules linked in: bnep usbhid imx_sdma flexcan btusb btrtl btbcm btintel smsc95xx usbnet mii bluetooth > [ 58.460882] CPU: 0 PID: 377 Comm: sshd Tainted: G W 4.5.1 #3 > [ 58.467671] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) > [ 58.474199] Backtrace: > [ 58.476675] [] (dump_backtrace) from [] (show_stack+0x18/0x1c) > [ 58.484244] r6:60000113 r5:c05a96c0 r4:00000000 r3:00000000 > [ 58.489964] [] (show_stack) from [] (dump_stack+0x9c/0xb0) > [ 58.497197] [] (dump_stack) from [] (warn_slowpath_common+0x8c/0xbc) > [ 58.505286] r6:c01f9c74 r5:00000009 r4:ee9f17f8 r3:c0596da4 > [ 58.511002] [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x38/0x40) > [ 58.519698] r8:00000042 r7:00000001 r6:00000000 r5:00000000 r4:c050c020 > [ 58.526470] [] (warn_slowpath_fmt) from [] (check_unmap+0x9d0/0xab8) > [ 58.534559] r3:c0520e6c r2:c050c020 > [ 58.538159] r4:00000000 > [ 58.540710] [] (check_unmap) from [] (debug_dma_unmap_page+0x84/0x8c) > [ 58.548886] r10:ef2ec000 r9:f09e5fa0 r8:ef0ef810 r7:00000001 r6:00000000 r5:00000042 > [ 58.556780] r4:00000001 > [ 58.559336] [] (debug_dma_unmap_page) from [] (fec_txq+0x140/0x31c) > [ 58.567338] r8:ef0ef810 r7:00000000 r6:00000000 r5:00000000 r4:ef2c6000 > [ 58.574108] [] (fec_txq) from [] (fec_enet_napi_q1+0x98/0xe8) > [ 58.581589] r10:08000000 r9:ef2ec580 r8:00000000 r7:00000040 r6:00000000 r5:ef2ec000 I think I've already fixed this, but I've only submitted once. commit 466cb4a2e5583d2e18470f30d5948edcf4b947f5 Author: Troy Kisky Date: Wed Jan 20 12:52:10 2016 -0700 net: fec: update dirty_tx even if no skb If dirty_tx isn't updated, then dma_unmap_single will be called twice. Signed-off-by: Troy Kisky Tested-by: diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 452be9c..150a90a 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1243,10 +1243,8 @@ static void fec_txq(struct net_device *ndev, struct fec_enet_priv_tx_q *txq) fec16_to_cpu(bdp->cbd_datlen), DMA_TO_DEVICE); bdp->cbd_bufaddr = cpu_to_fec32(0); - if (!skb) { - bdp = fec_enet_get_nextdesc(bdp, &txq->bd); - continue; - } + if (!skb) + goto skb_done; /* Check for errors. */ if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | @@ -1285,7 +1283,7 @@ static void fec_txq(struct net_device *ndev, struct fec_enet_priv_tx_q *txq) /* Free the sk buffer associated with this last transmit */ dev_kfree_skb_any(skb); - +skb_done: /* Make sure the update to bdp and tx_skbuff are performed * before dirty_tx */