Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4641983ybl; Mon, 9 Dec 2019 14:27:36 -0800 (PST) X-Google-Smtp-Source: APXvYqwtxNy/FWouEzL9t8a0mskvL+zw+pHrQUSqxJ5D1rOC5F2UFhlU+AFEEOG7R2fmqlzIVPYO X-Received: by 2002:a05:6830:1707:: with SMTP id 7mr24686413otk.185.1575930456433; Mon, 09 Dec 2019 14:27:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575930456; cv=none; d=google.com; s=arc-20160816; b=nQSq7hJo48wrvhZNK3jSX8jrDqblj+5M4yaxSiCkapuCH42uu4u6FTEUo25H0cl/i8 bAc3XIEvWZkBUTCbKK8P/NvTQoIiTBXM3U9J+mXeAPVpN7huB5cBXNxy7JW+JxqFWLxm 63HYS1KCou6jqSR5gLQdCpktwDBedJ4urWXgZVHokgWeHH6ATEElDIT6fh+jyPMo9uYr xgjWmNNFD/ZYVreCIlvJiaIhOl2YjvonEHYKz4xTlOddaOZT7UqNoQ+4fotl3/vjv4rC O70gacWirySTyCe9Zs/oZzoolnNjv1Ckcy8F+BHWtQ7KzZeAlrMs57rH/WIc0RDElRD9 5kww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=BynIa6/4yu4996pyQ5oYCnYJ5CYu/aRvvHqbLyWEGz4=; b=cuxDyYoYCTyhDNpET3+j7atjLAUfASuRPo3UTQ8xsFYQ5WgBFdMQjTdyYgAJXQwjgB MLkB4x0t8psiZ4eB1eVetebDMF2ZC341R0h8Qn1DSyXXt6YnIYoNTfPFZs/DHQzpSsDj qg227At4YEiL0PpL29iJmrbpoGmwXR05wtlLKePFFBeAskXZUo8gIyIdxXj4xXSb9U0p s7zfSp6wmWsomaMJAwTqtzL4rGIEjHLgGHKbQN7OvUinecIerKiuFr2Nhd1Q0OwDg2BS sSUJkb5VLjKUqR5UvYe3xprzJqM++pfWL/NWye/A3eY0NVa9/FYgHmdabo5d8xzalBmX LW0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z23si788068otm.284.2019.12.09.14.27.24; Mon, 09 Dec 2019 14:27:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726968AbfLIW0y (ORCPT + 99 others); Mon, 9 Dec 2019 17:26:54 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:36466 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726156AbfLIW0y (ORCPT ); Mon, 9 Dec 2019 17:26:54 -0500 Received: from localhost (unknown [IPv6:2601:601:9f00:1c3::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 8B885154925CD; Mon, 9 Dec 2019 14:26:53 -0800 (PST) Date: Mon, 09 Dec 2019 14:26:53 -0800 (PST) Message-Id: <20191209.142653.1925547187942224188.davem@davemloft.net> To: grygorii.strashko@ti.com Cc: netdev@vger.kernel.org, ivan.khoronzhuk@linaro.org, nsekhar@ti.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: ethernet: ti: davinci_cpdma: fix warning "device driver frees DMA memory with different size" From: David Miller In-Reply-To: <20191209111924.22555-1-grygorii.strashko@ti.com> References: <20191209111924.22555-1-grygorii.strashko@ti.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 09 Dec 2019 14:26:53 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Grygorii Strashko Date: Mon, 9 Dec 2019 13:19:24 +0200 > The TI CPSW(s) driver produces warning with DMA API debug options enabled: > > WARNING: CPU: 0 PID: 1033 at kernel/dma/debug.c:1025 check_unmap+0x4a8/0x968 > DMA-API: cpsw 48484000.ethernet: device driver frees DMA memory with different size > [device address=0x00000000abc6aa02] [map size=64 bytes] [unmap size=42 bytes] > CPU: 0 PID: 1033 Comm: ping Not tainted 5.3.0-dirty #41 > Hardware name: Generic DRA72X (Flattened Device Tree) > [] (unwind_backtrace) from [] (show_stack+0x10/0x14) > [] (show_stack) from [] (dump_stack+0xd8/0x110) > [] (dump_stack) from [] (__warn+0xe0/0x10c) > [] (__warn) from [] (warn_slowpath_fmt+0x44/0x6c) > [] (warn_slowpath_fmt) from [] (check_unmap+0x4a8/0x968) > [] (check_unmap) from [] (debug_dma_unmap_page+0x80/0x90) > [] (debug_dma_unmap_page) from [] (__cpdma_chan_free+0x114/0x16c) > [] (__cpdma_chan_free) from [] (__cpdma_chan_process+0x158/0x17c) > [] (__cpdma_chan_process) from [] (cpdma_chan_process+0x3c/0x5c) > [] (cpdma_chan_process) from [] (cpsw_tx_mq_poll+0x48/0x94) > [] (cpsw_tx_mq_poll) from [] (net_rx_action+0x108/0x4e4) > [] (net_rx_action) from [] (__do_softirq+0xec/0x598) > [] (__do_softirq) from [] (do_softirq.part.4+0x68/0x74) > [] (do_softirq.part.4) from [] (__local_bh_enable_ip+0x124/0x17c) > [] (__local_bh_enable_ip) from [] (ip_finish_output2+0x294/0xb7c) > [] (ip_finish_output2) from [] (ip_output+0x210/0x364) > [] (ip_output) from [] (ip_send_skb+0x1c/0xf8) > [] (ip_send_skb) from [] (raw_sendmsg+0x9a8/0xc74) > [] (raw_sendmsg) from [] (sock_sendmsg+0x14/0x24) > [] (sock_sendmsg) from [] (__sys_sendto+0xbc/0x100) > [] (__sys_sendto) from [] (__sys_trace_return+0x0/0x14) > Exception stack(0xea9a7fa8 to 0xea9a7ff0) > ... > > The reason is that cpdma_chan_submit_si() now stores original buffer length > (sw_len) in CPDMA descriptor instead of adjusted buffer length (hw_len) > used to map the buffer. > > Hence, fix an issue by passing correct buffer length in CPDMA descriptor. > > Cc: Ivan Khoronzhuk > Fixes: 6670acacd59e ("net: ethernet: ti: davinci_cpdma: add dma mapped submit") > Signed-off-by: Grygorii Strashko > --- > changes in v3: > - removed swlen local var Applied and queued up for -stable, thanks.