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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1DE88C433F5 for ; Wed, 11 May 2022 08:25:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QHmU9oQI70SpbQLmJcKBZwgjRurUJXPFjhQQnf+73EU=; b=rQ3hNtrmqlr+da s4Az023u3IjUn9ZX12AL5I+1ZK+tCEKttDBI3DdHgKSCz0t0wmi/tq/WLO0pPQwpXPAJeTrjGKqoK sPMIRCSLa9SQTiM2EOFjw6K5TxlP+nisCFZoA5jMiPfvG2S+a5ggTOSkhvBV+B9xlKhgRgONxjo4W YYohq0eBDI1Z+s2us2qQp+yiIrJNScCC9kvQpT0R5VbRyDfNHcSxFbyx2W28Sw8vzHKfVaPdYGpg1 XOyPh16f+Il0Tr8jfKVgFEwqX5nNFRUONknedJKBgRTzHueAGie9yghvYJO1DbXQKg66sFi+X7OXd /I25Odl7lvlrN0hjvvIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nohdi-005uyE-Le; Wed, 11 May 2022 08:24:10 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nohde-005uwW-Da for linux-arm-kernel@lists.infradead.org; Wed, 11 May 2022 08:24:09 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A67FF106F; Wed, 11 May 2022 01:24:04 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.3.187]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A24923F73D; Wed, 11 May 2022 01:24:00 -0700 (PDT) Date: Wed, 11 May 2022 09:23:56 +0100 From: Mark Rutland To: Thomas Gleixner Cc: Lukas Wunner , maz@kernel.org, Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, Octavian Purdila , linux-kernel@vger.kernel.org, aou@eecs.berkeley.edu, catalin.marinas@arm.com, deanbo422@gmail.com, green.hu@gmail.com, guoren@kernel.org, jonas@southpole.se, kernelfans@gmail.com, linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, nickhu@andestech.com, palmer@dabbelt.com, paul.walmsley@sifive.com, shorne@gmail.com, stefan.kristiansson@saunalahti.fi, tsbogend@alpha.franken.de, vgupta@kernel.org, vladimir.murzin@arm.com, will@kernel.org, Peter Zijlstra Subject: Re: [PATCH v2 17/17] irq: remove handle_domain_{irq,nmi}() Message-ID: References: <20211026092504.27071-1-mark.rutland@arm.com> <20211026092504.27071-18-mark.rutland@arm.com> <20220506203242.GA1855@wunner.de> <20220510121320.GA3020@wunner.de> <87a6bpov9u.ffs@tglx> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87a6bpov9u.ffs@tglx> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220511_012406_573765_059D0876 X-CRM114-Status: GOOD ( 26.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, May 11, 2022 at 12:52:29AM +0200, Thomas Gleixner wrote: > On Tue, May 10 2022 at 15:15, Mark Rutland wrote: > > On Tue, May 10, 2022 at 02:13:20PM +0200, Lukas Wunner wrote: > >> For gpio-dln2.c, I believe it from inspection. > >> > >> For smsc95xx.c, I'm actually seeing it go wrong in practice, > >> unedited dmesg splat is included below FWIW. > > > > Thanks; having the trace makes this much easier to analyse. > > which confirmes what I talked about before: > > >> WARNING: CPU: 3 PID: 75 at kernel/irq/irqdesc.c:702 generic_handle_domain_irq+0x88/0x94 > >> generic_handle_domain_irq from smsc95xx_status+0x54/0xb0 > >> smsc95xx_status from intr_complete+0x80/0x84 > >> intr_complete from __usb_hcd_giveback_urb+0xa4/0x12c > >> __usb_hcd_giveback_urb from usb_hcd_giveback_urb+0x118/0x11c > >> usb_hcd_giveback_urb from completion_tasklet_func+0x7c/0xc8 > >> completion_tasklet_func from tasklet_callback+0x20/0x24 > >> tasklet_callback from tasklet_action_common.constprop.0+0x148/0x220 > >> tasklet_action_common.constprop.0 from tasklet_hi_action+0x28/0x30 > >> tasklet_hi_action from __do_softirq+0x154/0x3e8 > >> __do_softirq from __local_bh_enable_ip+0x12c/0x1a8 > >> __local_bh_enable_ip from irq_forced_thread_fn+0x7c/0xac > >> irq_forced_thread_fn from irq_thread+0x16c/0x228 > >> irq_thread from kthread+0x100/0x140 > > So what happens here: > > interrupt > -> wakeup threaded handler > > threaded handler runs > local_bh_disable(); > .... > schedules tasklet > ... > local_bh_enable() > do_softirq() > run_tasklet() > urb_completion() > smsc95xx_status() > generic_handle_domain_irq() > > That interrupt in question is an interrupt, which is not handled by the > primary CPU interrupt chips. It's a synthetic interrupt which is > generated from the received USB packet. > > + /* USB interrupts are received in softirq (tasklet) context. > + * Switch to hardirq context to make genirq code happy. > + */ > + local_irq_save(flags); > + __irq_enter_raw(); > + > if (intdata & INT_ENP_PHY_INT_) > - ; > + generic_handle_domain_irq(pdata->irqdomain, PHY_HWIRQ); > > This __irq_enter_raw() is really wrong. This is _not_ running in hard > interrupt context. Pretending so creates more problems than it > solves. It breaks context tracking, confuses lockdep ... > > We also have demultiplexed interrupts which are nested in a threaded > interrupt handler and share the thread context. No, we are not going to > pretend that they run in hard interrupt context either. > > So we need a clear distinction between interrupts which really happen in > hard interrupt context and those which are synthetic and can be invoked > from pretty much any context. > > Anything else is just a recipe for disaster and endless supply of half > baken hacks. Agreed. IIUC everyone agrees the __irq_enter_raw() usage is a hack, but what's not clear is what we *should* do -- sorry if I'm being thick here. I suspect that given we have generic_handle_irq_safe() for situations like this we should add a generic_handle_domain_irq_safe(), and use that in this driver? That way we can keep the `WARN_ON_ONCE(!in_hardirq())` in generic_handle_domain_irq(). ... or do you think we should do something else entirely? Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel