From patchwork Sat Nov 15 10:49:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 40872 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4CCB321175 for ; Sat, 15 Nov 2014 10:49:48 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id a1sf1470449wgh.3 for ; Sat, 15 Nov 2014 02:49:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=yJ35Q0SOyIjr552S6jolF/zeueR+V4eXHVDnCcxFnWo=; b=Fp9VNzb5uNeilxcKQuiVDHDu7pWYsDFT+oDjjiwt/om9mxOs1UOraxPOkffHUXsyNC h4SwpKzXmCxjyjeTE87axSCTVluXRzs8pbosu9CI4Lusb1QBBKgXinxcJ/7rR1IAqehK zy55dFUwC/U/d985LpnoWuVK2nGSByLRj6z5916ai6u8veddZNaSksSIckhFhIEZc+dx 6lI0rKnyre3NlRp7M89ra+z431ez4j2Gu1Qhc2kINb+IwaoJTdLdxAYyPRWxU5AJcQb1 kgs2xb1kPYJnwOwdtmhKsS/jjBjogg/sK7gLuQrcdlBvRD3SABjJBiGedlxiPilcerFJ EWQQ== X-Gm-Message-State: ALoCoQkQNXIVKwME6z9PfsV7CiGFut19H7qCCAoxJqN0V3dXsh9vsx/pumSrnyeiUIw1tCdGRp+h X-Received: by 10.180.101.170 with SMTP id fh10mr2095289wib.4.1416048587542; Sat, 15 Nov 2014 02:49:47 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.108 with SMTP id lf12ls831019lac.48.gmail; Sat, 15 Nov 2014 02:49:47 -0800 (PST) X-Received: by 10.112.247.43 with SMTP id yb11mr13303245lbc.51.1416048587147; Sat, 15 Nov 2014 02:49:47 -0800 (PST) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id r2si19563425lar.2.2014.11.15.02.49.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 15 Nov 2014 02:49:46 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id b6so13878943lbj.2 for ; Sat, 15 Nov 2014 02:49:46 -0800 (PST) X-Received: by 10.112.17.101 with SMTP id n5mr691206lbd.83.1416048586761; Sat, 15 Nov 2014 02:49:46 -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 ew9csp910814lbc; Sat, 15 Nov 2014 02:49:45 -0800 (PST) X-Received: by 10.70.126.38 with SMTP id mv6mr16321755pdb.28.1416048584897; Sat, 15 Nov 2014 02:49:44 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ys9si30720718pab.0.2014.11.15.02.49.44 for ; Sat, 15 Nov 2014 02:49:44 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753930AbaKOKtk (ORCPT + 26 others); Sat, 15 Nov 2014 05:49:40 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:48568 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752191AbaKOKti (ORCPT ); Sat, 15 Nov 2014 05:49:38 -0500 Received: from [90.219.10.17] (helo=why.wild-wind.fr.eu.org) by cheepnis.misterjones.org with esmtpsa (TLSv1.2:AES128-SHA256:128) (Exim 4.80) (envelope-from ) id 1Xpav6-0006NY-AA; Sat, 15 Nov 2014 11:49:32 +0100 From: Marc Zyngier To: Thomas Gleixner , Jiang Liu Cc: Yingjoe Chen , Bjorn Helgaas , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] genirq: Work around __irq_set_handler vs stacked domains ordering issues Date: Sat, 15 Nov 2014 10:49:13 +0000 Message-Id: <1416048553-29289-3-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1416048553-29289-1-git-send-email-marc.zyngier@arm.com> References: <1416048553-29289-1-git-send-email-marc.zyngier@arm.com> X-SA-Exim-Connect-IP: 90.219.10.17 X-SA-Exim-Rcpt-To: tglx@linutronix.de, jiang.liu@linux.intel.com, yingjoe.chen@mediatek.com, bhelgaas@google.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-SA-Exim-Mail-From: marc.zyngier@arm.com X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.217.171 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , With the introduction of stacked domains, we have the issue that, depending on where in the stack this is called, __irq_set_handler will succeed or fail: If this is called from the inner irqchip, __irq_set_handler() will fail, as it will look at the outer domain as the (desc->irq_data.chip == &no_irq_chip) test fails (we haven't set the top level yet). This patch implements the following: "If there is at least one valid irqchip in the domain, it will probably sort itself out". This is clearly not ideal, but it is far less confusing then crashing because the top-level domain is not up yet. Signed-off-by: Marc Zyngier --- kernel/irq/chip.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index d028b34..cad4f62 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -731,7 +731,16 @@ __irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, if (!handle) { handle = handle_bad_irq; } else { - if (WARN_ON(desc->irq_data.chip == &no_irq_chip)) + struct irq_data *irq_data = &desc->irq_data; +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY + while (irq_data) { + if (irq_data->chip != &no_irq_chip) + break; + irq_data = irq_data->parent_data; + } +#endif + + if (WARN_ON(!irq_data || irq_data->chip == &no_irq_chip)) goto out; }