From patchwork Thu Dec 8 21:54:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 9467203 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 14FD260231 for ; Thu, 8 Dec 2016 22:02:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 079672855A for ; Thu, 8 Dec 2016 22:02:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF7782860F; Thu, 8 Dec 2016 22:02:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C8932855A for ; Thu, 8 Dec 2016 22:02:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752754AbcLHWCZ (ORCPT ); Thu, 8 Dec 2016 17:02:25 -0500 Received: from fllnx210.ext.ti.com ([198.47.19.17]:37836 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752588AbcLHWCY (ORCPT ); Thu, 8 Dec 2016 17:02:24 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id uB8LscD7022455; Thu, 8 Dec 2016 15:54:38 -0600 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id uB8LscR2015708; Thu, 8 Dec 2016 15:54:38 -0600 Received: from [128.247.83.173] (128.247.83.173) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Thu, 8 Dec 2016 15:54:37 -0600 Subject: Re: [PATCH] usb: dwc3: omap: Fix imprecise external abort and oops on boot To: Tony Lindgren , Felipe Balbi References: <20161208032108.21962-1-tony@atomide.com> <87lgvqkb6f.fsf@linux.intel.com> <20161208153734.GF4264@atomide.com> CC: Greg Kroah-Hartman , Roger Quadros , Sekhar Nori , , From: Grygorii Strashko Message-ID: <9cce1e34-2fec-9477-4827-6b4c67920a8a@ti.com> Date: Thu, 8 Dec 2016 15:54:33 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161208153734.GF4264@atomide.com> X-Originating-IP: [128.247.83.173] Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Tony, On 12/08/2016 09:37 AM, Tony Lindgren wrote: > * Felipe Balbi [161208 01:45]: >> Tony Lindgren writes: >>> Somehow starting with v4.9-rc7 there have been imprecise >> >> There's nothing touching dwc3 since v4.9-rc5. > > Right, nothing obvious has changed. I think it's just a slight timing > change in the code that started triggering it. > >>> external aborts on omap5-uevm dwc3 controller. I have not been >>> able to bisect what exactly triggered this as it does not always >>> happen. It seems that something changed with probing that >>> now exposes the issue: >>> >>> Unhandled fault: imprecise external abort (0x1406) at 0x00000000 >> >> hmmm, clock disabled... dwc3-omap shouldn't have pm runtime at all. > > It does for the interconnect target module clkctrl register via PM > runtime. That's the "usb_otg_ss" module. > >>> ... >>> PC is at dwc3_omap_interrupt_thread+0x20/0x80 >>> LR is at irq_thread_fn+0x1c/0x54 >>> ... >>> [] (dwc3_omap_interrupt_thread) from [] >>> (irq_thread_fn+0x1c/0x54) >>> [] (irq_thread_fn) from [] (irq_thread+0x12c/0x1f0) >>> [] (irq_thread) from [] (kthread+0xdc/0xf4) >>> [] (kthread) from [] (ret_from_fork+0x14/0x3c) >>> ... >>> >>> Unable to handle kernel paging request at virtual address ffffffec >>> ... >>> Internal error: Oops: 37 [#2] SMP ARM >>> PC is at kthread_data+0x4/0xc >>> LR is at irq_thread_dtor+0x28/0xd0 >>> ... >>> [] (kthread_data) from [] (irq_thread_dtor+0x28/0xd0) >>> [] (irq_thread_dtor) from [] (task_work_run+0xb8/0xdc) >>> [] (task_work_run) from [] (do_exit+0x314/0xa20) >>> [] (do_exit) from [] (die+0x410/0x474) >>> [] (die) from [] (do_DataAbort+0xb4/0xb8) >>> [] (do_DataAbort) from [] (__dabt_svc+0x58/0x80) >>> Exception stack(0xee777ec8 to 0xee777f10) >>> 7ec0: 0000014d ee6e6f10 00000034 fc020034 ee6e6f10 ee1eec00 >>> 7ee0: 00000000 00000000 ee6ec640 c038a4bc 00000000 00000000 00000000 ee777f18 >>> 7f00: c038a4d8 c0989fa8 60000013 ffffffff >>> [] (__dabt_svc) from [] (dwc3_omap_interrupt_thread+0x20/0x80) >>> [] (dwc3_omap_interrupt_thread) from [] (irq_thread_fn+0x1c/0x54) >>> [] (irq_thread_fn) from [] (irq_thread+0x12c/0x1f0) >>> [] (irq_thread) from [] (kthread+0xdc/0xf4) >>> [] (kthread) from [] (ret_from_fork+0x14/0x3c) >>> >>> Fix the issue by making sure the dwc3 interrupts are disabled >>> before we call devm_request_threaded_irq(). >> >> that should already be the case. Are you sure that register isn't zero >> in probe? > > Looks like irq0_status = 0 and irqmisc_status = 0x2121. Also just > clearing irqmisc with dwc3_omap_write_irqmisc_clr(omap, 0xffffffff) > stops the issue from happening. > > There is some deferred probing happening but irqmisc is always 0x2121. > My assumption is that you have race here between IRQ handler and PM runtime in error handling path during deferred probing. Will below change fix issue for you? Tested-by: Tony Lindgren diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 29e80cc..dbc21bc 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -517,12 +517,12 @@ static int dwc3_omap_probe(struct platform_device *pdev) if (ret) { dev_err(dev, "failed to request IRQ #%d --> %d\n", omap->irq, ret); - goto err1; + goto err11; } ret = dwc3_omap_extcon_register(omap); if (ret < 0) - goto err1; + goto err11; ret = of_platform_populate(node, NULL, NULL, dev); if (ret) { @@ -538,6 +538,8 @@ static int dwc3_omap_probe(struct platform_device *pdev) extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb); extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb); +err11: + disable_irq(omap->irq); err1: pm_runtime_put_sync(dev); pm_runtime_disable(dev);