From patchwork Fri Nov 21 10:52:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 41295 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E215B23C27 for ; Fri, 21 Nov 2014 10:54:50 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id u10sf656042lbd.2 for ; Fri, 21 Nov 2014 02:54:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:in-reply-to :organization:references:user-agent:date:message-id:mime-version:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:content-type:content-transfer-encoding :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=0/bzLDfrXY/o/rdMQEjR817hZoBDeRM6iyW735M9yYM=; b=BC32OdbfrItDlQiBok6cFW13nGOJ5EQUFdOVROrL3gEro3yQjPftWwIqx+VHvNogNy MKHLtF34azBC4EhU9SF/W6xUK5ulNFRqAn4FfrMyOKGdb8ZkkUshasiK97Li5NPG95vC Ib2/B7JDjmfz0ZJ2G622wNS/cT6Nr5vBIzQLtR9dv6QybVS05Ihv5b7usa++lUWyuWbq XsB7ddgi5tZlQpMnwi78VAnswC3K36HTQkED70T1yBsty5Ie6W9WKZuq1cD4iLpQpqHj Zxp7lVgjwVN8sgn7z6UdNpyXC2nTx7Vd36Yc9e6PmaWFa1XBkNnzX1d6Ib5pPhtid+aL RGZA== X-Gm-Message-State: ALoCoQkE4jhsPwbioIJMx7C6r1pQHZ2PEvqvukAbnsIv2yF80Cx4udi0N02XOphO8IwicYi+6GJV X-Received: by 10.181.12.37 with SMTP id en5mr10828906wid.6.1416567289767; Fri, 21 Nov 2014 02:54:49 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.71 with SMTP id t7ls171583lae.11.gmail; Fri, 21 Nov 2014 02:54:49 -0800 (PST) X-Received: by 10.152.28.227 with SMTP id e3mr3697858lah.54.1416567289607; Fri, 21 Nov 2014 02:54:49 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id pd10si4736651lbc.128.2014.11.21.02.54.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Nov 2014 02:54:49 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id pv20so3981504lab.37 for ; Fri, 21 Nov 2014 02:54:49 -0800 (PST) X-Received: by 10.112.138.137 with SMTP id qq9mr3596975lbb.80.1416567289476; Fri, 21 Nov 2014 02:54:49 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp63854lbc; Fri, 21 Nov 2014 02:54:48 -0800 (PST) X-Received: by 10.70.43.68 with SMTP id u4mr6258683pdl.6.1416567287722; Fri, 21 Nov 2014 02:54:47 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id qn7si7704218pbc.63.2014.11.21.02.54.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Nov 2014 02:54:47 -0800 (PST) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xrlq2-0002Ni-Uh; Fri, 21 Nov 2014 10:53:18 +0000 Received: from foss-mx-na.foss.arm.com ([217.140.108.86]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xrlpy-0002EL-PN for linux-arm-kernel@lists.infradead.org; Fri, 21 Nov 2014 10:53:15 +0000 Received: from foss-smtp-na-1.foss.arm.com (unknown [10.80.61.8]) by foss-mx-na.foss.arm.com (Postfix) with ESMTP id 42EAFD6; Fri, 21 Nov 2014 04:52:47 -0600 (CST) Received: from collaborate-mta1.arm.com (highbank-bc01-b06.austin.arm.com [10.112.81.134]) by foss-smtp-na-1.foss.arm.com (Postfix) with ESMTP id 0B8775FAD7; Fri, 21 Nov 2014 04:52:40 -0600 (CST) Received: from approximate.cambridge.arm.com (approximate.cambridge.arm.com [10.1.209.28]) by collaborate-mta1.arm.com (Postfix) with ESMTPS id EAE0013F6FA; Fri, 21 Nov 2014 04:52:38 -0600 (CST) From: Marc Zyngier To: Dmitry Eremin-Solenikov Subject: Re: IRQ #0 broken on ARM In-Reply-To: (Dmitry Eremin-Solenikov's message of "Fri, 21 Nov 2014 10:31:05 +0000") Organization: ARM Ltd References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Date: Fri, 21 Nov 2014 10:52:37 +0000 Message-ID: <87zjbk966i.fsf@approximate.cambridge.arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141121_025314_826896_4C03614E X-CRM114-Status: GOOD ( 23.02 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Andrea Adami , Thomas Gleixner , Russell King - ARM Linux , linux-arm-kernel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: marc.zyngier@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 On Fri, Nov 21 2014 at 10:31:05 am GMT, Dmitry Eremin-Solenikov wrote: > Hello, > > After the commit a71b092a9c68685a270ebdde7b5986ba8787e575 > (ARM: Convert handle_IRQ to use __handle_domain_irq) IRQ #0 is broken > on ARM. It is a valid IRQ and it is quite imporant (on sa1100 it's a GPIO0). Well, this is a valid IRQ number if you're not using irq domains. I may be a bit pedantic here, but I thing this is an important distinction. > The worst thing is that the CPU will be stuck busy-looping around this > IRQ w/o printing anything to the console or masking the irq. How > should we cope with that? I'd like to propose to either revert the > offending commit or to add the following patch. Well, said commit fixes a rather important bug, so I suggest we keep around. Now, as for your suggestion: > -- > With best wishes > Dmitry > > From e87f86497b796ed55fff644bbc75bf1890941829 Mon Sep 17 00:00:00 2001 > From: Dmitry Eremin-Solenikov > Date: Fri, 21 Nov 2014 13:27:11 +0300 > Subject: [PATCH] genirq: handle IRQ 0 in __handle_domain_irq > > __handle_domain_irq() function will ignore (well, report as bad) the IRQ > number 0. On some platforms IRQ0 is bad IRQ. On others it is not. And > while platforms are still in the process of converging to not using > IRQ number 0 as a valid IRQ, I'd like to propose to use IRQ0 as a valid > one in __handle_domain_irq(). > > Signed-off-by: Dmitry Eremin-Solenikov > --- > kernel/irq/irqdesc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c > index a1782f8..bfbeeb6 100644 > --- a/kernel/irq/irqdesc.c > +++ b/kernel/irq/irqdesc.c > @@ -365,7 +365,7 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq, > * Some hardware gives randomly wrong interrupts. Rather > * than crashing, do something sensible. > */ > - if (unlikely(!irq || irq >= nr_irqs)) { > + if (unlikely(irq >= nr_irqs)) { > ack_bad_irq(irq); > ret = -EINVAL; > } else { As I mentioned above, IRQ0 is not valid when using irq domains. As an alternative, how about this: I don't have a platform to test this on, but maybe you could give it a go and let me know if that helps? Thanks, M. diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index a1782f8..9f5bc92 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -365,7 +365,7 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq, * Some hardware gives randomly wrong interrupts. Rather * than crashing, do something sensible. */ - if (unlikely(!irq || irq >= nr_irqs)) { + if (unlikely((lookup && !irq) || irq >= nr_irqs)) { ack_bad_irq(irq); ret = -EINVAL; } else {