Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3846164ybl; Mon, 12 Aug 2019 07:21:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHZ0QJfLmHXBL6wq36Xp1YuXOstTRuFww9eMruXooc+BvsKyv2v15HO+TVT5qcxQsFD0u9 X-Received: by 2002:a17:902:e4:: with SMTP id a91mr33050779pla.150.1565619695997; Mon, 12 Aug 2019 07:21:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565619695; cv=none; d=google.com; s=arc-20160816; b=SYgjKTs14eg7wReZUJ1+gWz5ulGbngofxxjiQ5t0SzO6jTDM9sSM9n5Oqz6Q6bczbS eu0+CHL/2pyld/f2reJucXwj4svlDRUl46QoFA3umlV2zpZ9T8jxjsGZJdevdHi8QqgR WkstliWHThUU+299GM0rpwg2zjlsXekAdp8KLLyzUcZaLAFbJTXj2H84yVJA974T0p1r 9KbPlYHmKIlgeLa58g7fhgdIEByQ02g/o+I6+NDTbM6w2a572Jk+NA7+4SugvkkGk/1Z CnI24CPujpwvEFZwvROcTnT9rpYKO0UGnQoOsOxCgoOlgXz5OeVAASZJGhzcfMKm35Zu r0iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=t0vteZoiBALficFEWuoYIrGr06tINAqFir4dxRsbW9Q=; b=Ss2n09HTOzUXVe7V0ewwzt2POh4oOFVpcv9u/xhmeBsc6GMWXrPtNT8DhCd8LJcKj3 btjHA6zvZip1pjBsDFlfR4Y/Wb3ZsMwJYccXd89WoNCjZ/vsOPOscze7XjUaQsnXwBn3 Qn3472w5y92uwBrcjMtDUIu0tRfsNZeK4d9AnaQFEYo9dwARX30kIEv9PExwq5a0HJAj JdmkTBIOoh0RL/W1GQ80rAEL+kP0fxtBUt00aA2rIFc92KuXAN3YNOTIuv/9iC3p1hwR n6a2/VpANmdyFFMi/dj/4g+3BkVSNKsez1cLGZMLx3CBkAu7Kiv+u4CnsJNFHx32GiwT EtyQ== 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 d13si63576465pgu.268.2019.08.12.07.21.20; Mon, 12 Aug 2019 07:21:35 -0700 (PDT) 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 S1727880AbfHLOUJ (ORCPT + 99 others); Mon, 12 Aug 2019 10:20:09 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:46886 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727206AbfHLOUI (ORCPT ); Mon, 12 Aug 2019 10:20:08 -0400 Received: (qmail 2923 invoked by uid 2102); 12 Aug 2019 10:20:07 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 12 Aug 2019 10:20:07 -0400 Date: Mon, 12 Aug 2019 10:20:07 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Felipe Balbi cc: Pawel Laszczak , "devicetree@vger.kernel.org" , "gregkh@linuxfoundation.org" , "linux-usb@vger.kernel.org" , "hdegoede@redhat.com" , "heikki.krogerus@linux.intel.com" , "robh+dt@kernel.org" , "rogerq@ti.com" , "linux-kernel@vger.kernel.org" , "jbergsagel@ti.com" , "nsekhar@ti.com" , "nm@ti.com" , Suresh Punnoose , "peter.chen@nxp.com" , Jayshri Dajiram Pawar , Rahul Kumar Subject: RE: [PATCH v9 5/6] usb:cdns3 Add Cadence USB3 DRD Driver In-Reply-To: <877e7iu0xw.fsf@gmail.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 12 Aug 2019, Felipe Balbi wrote: > I don't understand the intricacies of the coherent API to judge if it's > a bug in the API itself. In any case, here's where the splat comes from: > > void dma_free_attrs(struct device *dev, size_t size, void *cpu_addr, > dma_addr_t dma_handle, unsigned long attrs) > { > const struct dma_map_ops *ops = get_dma_ops(dev); > > if (dma_release_from_dev_coherent(dev, get_order(size), cpu_addr)) > return; > /* > * On non-coherent platforms which implement DMA-coherent buffers via > * non-cacheable remaps, ops->free() may call vunmap(). Thus getting > * this far in IRQ context is a) at risk of a BUG_ON() or trying to > * sleep on some machines, and b) an indication that the driver is > * probably misusing the coherent API anyway. > */ > WARN_ON(irqs_disabled()); > > if (!cpu_addr) > return; > > debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); > if (dma_is_direct(ops)) > dma_direct_free(dev, size, cpu_addr, dma_handle, attrs); > else if (ops->free) > ops->free(dev, size, cpu_addr, dma_handle, attrs); > } > EXPORT_SYMBOL(dma_free_attrs); > > maybe you're gonna have to fire up a workqueue to free this memory for > you :-( > > Unless someone else has better ideas. Alan, Greg, any ideas? I don't understand it very well myself, but there have been posts by some of the DMA maintainers on this topic. Maybe you can try asking them. Alan Stern