Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4545628ybl; Mon, 9 Dec 2019 12:40:06 -0800 (PST) X-Google-Smtp-Source: APXvYqyjMSbV7hkJjt/ZgI61qBtvc42pF2p+HCl7giQ3aFFMA9tfCK1uf7v3NBCfN5/3w5K4szFj X-Received: by 2002:aca:b7c5:: with SMTP id h188mr975348oif.100.1575924006045; Mon, 09 Dec 2019 12:40:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575924006; cv=none; d=google.com; s=arc-20160816; b=a9XpLLByDCU7rGLaiOUqcqAjI0hEE58v3c/VS1l/Fqa37C0Qq4PUinjn1CVDf8ogYR xeM8gvGN62pNKQ+7mPtjSMxrljQWgYCymZqZrrMCHWxk1SIueYN9liqMQDRVuAQcd/XX 2w3/IEl3OITRuRsWlMZcrOFgqfNV+pSxVxk/qCEzeG8tTfz/HBiF+z4H9unJ6Fse5Dw/ Olghgf9IeSsLWWX0AfuCYy4MvDIXu4KMenbjZ1Q4WXFXMl2ISqXcW+Thk9/klC2O2C00 e7DHjAlmohdkuZNwe2ohTqC1zj6kJKB/4pEcNqCiFmqU71TAyUlA/3y8iJMGyDxfxGCf nW2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=w33D8YlO2VCmd0REKmfpLnJ7eSFQMkbZwyL94W5JDso=; b=f+6ZboCGk2RrDDF9RlgH0GUm4s7+6POoCylhHVTScB0BGRLNEW8aROFcLJR37yLC9q EnodMHzqLvAlEfsLFVpHjgWiiXqj7+FLWARC7kg+Ua4Xv9SfuZxxrOmxjvKSswME5brx CGcBcXmwxB1y7+tCP2f9U2PwBh39TmFuJrRuBL1osorQdaWj1baVK3DzqAJds3kZumHa pUzJwa3KuxM/Bs6fyIQA+V+3a+2mnRpQeT58FZi5DaQToEWezq5PbHL56AvyS/T6wADF SZcHDIXxczkhqOnOZE3xo3RFoH0bcHoEUHbZxbZmyjy5XwCfPVwQt5UA0Gf5jy6xxLkx Y9NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=brA1NQR9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16si716102otk.151.2019.12.09.12.39.53; Mon, 09 Dec 2019 12:40:06 -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; dkim=pass header.i=@linaro.org header.s=google header.b=brA1NQR9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726668AbfLIUjW (ORCPT + 99 others); Mon, 9 Dec 2019 15:39:22 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:43769 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726342AbfLIUjW (ORCPT ); Mon, 9 Dec 2019 15:39:22 -0500 Received: by mail-lf1-f68.google.com with SMTP id 9so11803099lfq.10 for ; Mon, 09 Dec 2019 12:39:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=w33D8YlO2VCmd0REKmfpLnJ7eSFQMkbZwyL94W5JDso=; b=brA1NQR9xRXdNcnZQqlwqXlPSet22bI6+cOP5l+y2Zh4/HUu6M2aV1JiNTTzsZtOua WGJdNQjul6ZLVNO9+gZDS9xbwlrXXZtiZAPbFjRca/Mf0zbZDn7d8NK+E+7XzMAn3cyR eur7B2ELVxAuPu77vg6fYbMNnYfGfqAIiaE4iuKBnwfl80PQ16yacXZA3Zx/w+ozcG+W AmJLPc9p5oskfyRuf3NCxkeFNpGxCOaOCNi9c64aV4NS1YT9hli1ZvD01F+vA9ZspwB5 Oon3NR3LsgfH9iAqPsFLS0cwpOm2aUdZrd44cp96I7DVSGwnidr9k2hcYIUEU9XiyUQr J/Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=w33D8YlO2VCmd0REKmfpLnJ7eSFQMkbZwyL94W5JDso=; b=CjA9Q8Z2UU3Hh1qorZ1V4NKjcMy7Zt7MF0LQyxXSFYDHdboQGogy6+wZKytT0iEuPU N4myYYCZpjdQ8vtW6UeKkD49/83jlmIfEIzC+YUTwf3M6ws48jKGeEwVe+ejNQv4yQmW y1aRwV16ycSlAdsvtEHv/cskUWMED2fikZbZ0XRJDjGgM9lGGjE0BmF8st5jOchxsX+p vn5DSvKvOuI0CTxFEywQJwOx76aFqvNn3HaKPJweZ/BqXZwynut3uspqzEGlu5GfCzIO lpGHN3c80kvHuXx48odX2IS98Tp06vo4vX4rYBNAVhMV2x+oHZXKDzxjVbBgLTsRBEkz h3zg== X-Gm-Message-State: APjAAAWDNPUlS95mG6JnNt+Dg2Ehm+gv9NZHRFFcaq6AztKgH8mLLlCq 2yUCSpCWwjP61Z1GtzN9N5YOqA== X-Received: by 2002:ac2:4adc:: with SMTP id m28mr16246054lfp.26.1575923959975; Mon, 09 Dec 2019 12:39:19 -0800 (PST) Received: from khorivan (57-201-94-178.pool.ukrtel.net. [178.94.201.57]) by smtp.gmail.com with ESMTPSA id c23sm470663ljj.78.2019.12.09.12.39.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 12:39:19 -0800 (PST) Date: Mon, 9 Dec 2019 22:39:17 +0200 From: Ivan Khoronzhuk To: Grygorii Strashko Cc: "David S. Miller" , netdev@vger.kernel.org, Sekhar Nori , linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: ethernet: ti: davinci_cpdma: fix warning "device driver frees DMA memory with different size" Message-ID: <20191209203916.GA26682@khorivan> Mail-Followup-To: Grygorii Strashko , "David S. Miller" , netdev@vger.kernel.org, Sekhar Nori , linux-kernel@vger.kernel.org References: <20191209111924.22555-1-grygorii.strashko@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20191209111924.22555-1-grygorii.strashko@ti.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 09, 2019 at 01:19:24PM +0200, Grygorii Strashko wrote: >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 >--- Reviewed-by: Ivan Khoronzhuk -- Regards, Ivan Khoronzhuk