Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3278317imm; Fri, 25 May 2018 02:58:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqws7MDDASJOsKh16xAyfSZq0R2cWJRt0bCgSy2crH/eMvznslZ7vetM/5fnj2/UpSIXVOq X-Received: by 2002:a65:4289:: with SMTP id j9-v6mr1450675pgp.136.1527242313116; Fri, 25 May 2018 02:58:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527242313; cv=none; d=google.com; s=arc-20160816; b=AkRA6tXJGa0FVsltT9wNqA04HMXn6daUVFwrkTqwjb4QBjKdlBeFTsylMkXSN8CsU2 A1YBbq6rn8KSOGUQJNuspCm5ijcgbzoxCQsbVfwGFJlLTUbfsKL7yZWw2DI8h0yDc4kP qbA5pLk4LvaIULyMD46n1yyobuo88BeU2CHx4F56yGQMQu7MDlD8be9qiVCV0pDkMK5v 4p+Mzn5zdO7AK3UPHZ9pEUf3BhBua47hi8Bhp05pvY4ZYUjnTPpi8x23y1hPLsOsf5dx 0iHtNtRJhcyozGjEuB2nmnVQyB1fq/MVdP8cQEEgum4KHwpanNltNtTyyppw99Qv8TrU HO6Q== 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=oIo4sIbaRjKHpnVtvCoD82grDAauQjy4DN3RUKow99A=; b=QcFg11tFo0VCciat1xn/GGvjFRGEu7QilpV42BBUuXojQ8DO5EDe5bFbnqt13cviCH oW9swpnu7E528abJxTD5CYVfdjmh2LqZkcQ++JYVuStkjFg5k5HQhFAJ1lU1V1pg0ZXC L/ffeABczFrHkZUyY5jC5Bb+ELGL7KfpwGMDQ0t0SmomVagehzXaVcUBurK6eoS+gJxL VLThVSD0SkjMyncrQCzCFCmTEdYqW3XOFQvUleZhpqVFuw9RheDgG6Yh9fbbPM61Y/o9 9rKrYLNphxuhalBq33fg3wpLiE4tck/YA8B8SkjrwmXKrmOC59sJfezqb0khB3FLRj38 zLcA== 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 q12-v6si17779033pgn.377.2018.05.25.02.58.18; Fri, 25 May 2018 02:58:33 -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 S966032AbeEYJ4I (ORCPT + 99 others); Fri, 25 May 2018 05:56:08 -0400 Received: from foss.arm.com ([217.140.101.70]:57476 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965681AbeEYJuN (ORCPT ); Fri, 25 May 2018 05:50:13 -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 3833380D; Fri, 25 May 2018 02:50:13 -0700 (PDT) Received: from e112298-lin.cambridge.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 E1F523F25D; Fri, 25 May 2018 02:50:10 -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 v4 07/26] irqchip/gic-v3: Remove acknowledge loop Date: Fri, 25 May 2018 10:49:13 +0100 Message-Id: <1527241772-48007-8-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1527241772-48007-1-git-send-email-julien.thierry@arm.com> References: <1527241772-48007-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. 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(-) Note: The loop pattern also discourages from using PMR for IRQ masking because PMR needs to be unmasked to acknowledge interrupts. diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index e5d1014..0c58db3 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 void __init gic_dist_init(void) -- 1.9.1