Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7258131imm; Tue, 28 Aug 2018 08:54:18 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYlCzueil14t7KvNV3j+PjbJDP83ot1sRg/w8RVblMZIP11JNeOj3NldbaCpxnsZJo5++p0 X-Received: by 2002:a62:c9:: with SMTP id 192-v6mr2163340pfa.99.1535471658278; Tue, 28 Aug 2018 08:54:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535471658; cv=none; d=google.com; s=arc-20160816; b=J7wI09/6/YUWmyZITh94kTxWOaR0q7bvKk08uRoGY2rzLRl3/rcXYssEC7VAisVwNY c7UiM78qlyu7SV9moqKl+qlDf52FBgcIBsEV6rZe2NZYRbkdAJOKZiW4ghRNfxFmj8P4 hbpzI2bcRRT7hN3ejZYQgoSQjDpKkV5n8qx6Zbl4bOQexYllxvbb/l3S7fztpX/o1qS8 pq+biDszZRlvNhh3PEwPE6z5fRWBWPWs1BO9gh49i2+ipJ8yQfNXnsr4JXMRsd9tYTOe x9lMfOf0yMKEle7dw67L9jnCQ6Om1NqKI+XLsj+wXRiQ5sHeS0gxHK2r7uK4Atyj3N9u yjpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=BZcyd2VfW8j/HjSRvcAh6nUl8dIxPxRnRbq2uws6nyY=; b=jEyBCQGYOG9AXG9TJ38D8gQr4sWgQ1whDjfriWfnZH2ZSkdCU+FOIDHeCh186xfjx1 Hj+nz+z8/ydU3z9JBv5PDsODXCxLuo3aUam5DFLNNkJ7mjshtQhmhmnAZP468rPO402g TGGujAS35K3NbUFsFbWT/thyWTqw5DnWA72fWIDAeGQVJZOAlQRKbnPq2lA/fgfnOskq WtDKB57FX6XFchlABK2GiL7tTLAjp/Luuzx214euNmN5vZNQBElTa7MzbT6fHc3124Ks Ig9nmTRvDCiTk0gjzBdNSUG92unS/WZD1bs7qqW1wTTl+0LdpjSxUVzRtTlNSixL1tGi 1iKA== 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 i5-v6si1251119pgg.84.2018.08.28.08.54.03; Tue, 28 Aug 2018 08:54:18 -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 S1727824AbeH1Tou (ORCPT + 99 others); Tue, 28 Aug 2018 15:44:50 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:41130 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeH1Tou (ORCPT ); Tue, 28 Aug 2018 15:44:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4130615BF; Tue, 28 Aug 2018 08:52:33 -0700 (PDT) Received: from e112298-lin.Emea.Arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0C8473F557; Tue, 28 Aug 2018 08:52:30 -0700 (PDT) From: Julien Thierry To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, daniel.thompson@linaro.org, joel@joelfernandes.org, marc.zyngier@arm.com, mark.rutland@arm.com, christoffer.dall@arm.com, james.morse@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, Julien Thierry , Thomas Gleixner , Jason Cooper Subject: [PATCH v5 19/27] irqchip/gic-v3: Remove acknowledge loop Date: Tue, 28 Aug 2018 16:51:29 +0100 Message-Id: <1535471497-38854-20-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1535471497-38854-1-git-send-email-julien.thierry@arm.com> References: <1535471497-38854-1-git-send-email-julien.thierry@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Multiple interrupts pending for a CPU is actually rare. Doing an acknowledge loop does not give much better performance or even can deteriorate them. Do not loop when an interrupt has been acknowledged, just return from interrupt and wait for another one to be raised. Tested-by: Daniel Thompson Signed-off-by: Julien Thierry Cc: Thomas Gleixner Cc: Jason Cooper Cc: Marc Zyngier --- drivers/irqchip/irq-gic-v3.c | 65 +++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 162c49c..a467fcf 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -348,48 +348,45 @@ static asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs { u32 irqnr; - do { - irqnr = gic_read_iar(); + irqnr = gic_read_iar(); - if (likely(irqnr > 15 && irqnr < 1020) || irqnr >= 8192) { - int err; + if (likely(irqnr > 15 && irqnr < 1020) || irqnr >= 8192) { + int err; - if (static_branch_likely(&supports_deactivate_key)) + if (static_branch_likely(&supports_deactivate_key)) + gic_write_eoir(irqnr); + else + isb(); + + err = handle_domain_irq(gic_data.domain, irqnr, regs); + if (err) { + WARN_ONCE(true, "Unexpected interrupt received!\n"); + if (static_branch_likely(&supports_deactivate_key)) { + if (irqnr < 8192) + gic_write_dir(irqnr); + } else { gic_write_eoir(irqnr); - else - isb(); - - err = handle_domain_irq(gic_data.domain, irqnr, regs); - if (err) { - WARN_ONCE(true, "Unexpected interrupt received!\n"); - if (static_branch_likely(&supports_deactivate_key)) { - if (irqnr < 8192) - gic_write_dir(irqnr); - } else { - gic_write_eoir(irqnr); - } } - continue; } - if (irqnr < 16) { - gic_write_eoir(irqnr); - if (static_branch_likely(&supports_deactivate_key)) - gic_write_dir(irqnr); + return; + } + if (irqnr < 16) { + gic_write_eoir(irqnr); + if (static_branch_likely(&supports_deactivate_key)) + gic_write_dir(irqnr); #ifdef CONFIG_SMP - /* - * Unlike GICv2, we don't need an smp_rmb() here. - * The control dependency from gic_read_iar to - * the ISB in gic_write_eoir is enough to ensure - * that any shared data read by handle_IPI will - * be read after the ACK. - */ - handle_IPI(irqnr, regs); + /* + * Unlike GICv2, we don't need an smp_rmb() here. + * The control dependency from gic_read_iar to + * the ISB in gic_write_eoir is enough to ensure + * that any shared data read by handle_IPI will + * be read after the ACK. + */ + handle_IPI(irqnr, regs); #else - WARN_ONCE(true, "Unexpected SGI received!\n"); + WARN_ONCE(true, "Unexpected SGI received!\n"); #endif - continue; - } - } while (irqnr != ICC_IAR1_EL1_SPURIOUS); + } } static u32 gic_get_pribits(void) -- 1.9.1