From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DDB6C43603 for ; Mon, 9 Dec 2019 20:39:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 404242068E for ; Mon, 9 Dec 2019 20:39:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="brA1NQR9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726718AbfLIUjZ (ORCPT ); Mon, 9 Dec 2019 15:39:25 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:32793 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726619AbfLIUjW (ORCPT ); Mon, 9 Dec 2019 15:39:22 -0500 Received: by mail-lf1-f65.google.com with SMTP id n25so11868381lfl.0 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=X6UBIlbzavD3qo0bQoQ1squ+brFCv+Etb3F3qy5j80r1BiV3vB+nsMnMDnGbWWMI+d dLfk36Bf4P2+NwPJYL6ulTtddJD7NyyZzkN9Tw9qKcz7pEw8QQceLHlFFyHsouVfi8Y+ eJU2jlaY9lYBP9/xdCxJaXwfvEU8Z/dZvoRWCG91XvaZTQer4MUMa2sVyHzgB01v9gtS tizMIrMIIJEw0tV9LNY1dLAK7H5Am3HtlmHOIQGhkjk/xLbIev+SuQ4rLfc6f3RVv7Mh jyuuXZaW9UcvZemdLcbActQsHmPATqSf/XCwTZcXo89NbEl69VD3N52t+hxKttpgEqdO GIlg== X-Gm-Message-State: APjAAAV6wK59DH1WqX4xy/x0gxWH2ndqqoOVdgWn980hd8Vm471mr4nH 40uwnW5tWyqeS7V5Jt5FJjd/CQ== X-Google-Smtp-Source: APXvYqyhPHrQ4wTGeljgNUPixik/HHZ7qCZyiiPk8/Y482i9XuSeM21JS91O8PrU1IkOFn8Wj36pyw== 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: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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