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 X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 522DDC07E96 for ; Thu, 15 Jul 2021 09:50:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2CB0F613C0 for ; Thu, 15 Jul 2021 09:50:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240331AbhGOJxc (ORCPT ); Thu, 15 Jul 2021 05:53:32 -0400 Received: from foss.arm.com ([217.140.110.172]:50212 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240295AbhGOJxc (ORCPT ); Thu, 15 Jul 2021 05:53:32 -0400 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 133A71042; Thu, 15 Jul 2021 02:50:39 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2D67D3F694; Thu, 15 Jul 2021 02:50:38 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org, tglx@linutronix.de Cc: mark.rutland@arm.com, maz@kernel.org, paulmck@kernel.org, peterz@infradead.org Subject: [PATCH v3 1/2] irq: abstract irqaction handler invocation Date: Thu, 15 Jul 2021 10:50:30 +0100 Message-Id: <20210715095031.41922-2-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210715095031.41922-1-mark.rutland@arm.com> References: <20210715095031.41922-1-mark.rutland@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We have a few functions which invoke irqaction handlers, all of which need to call trace_irq_handler_entry() and trace_irq_handler_exit(). In preparation for adding some additional debug logic to each irqaction handler invocation, let's factor out this work to a helper. Where the return value isn't consumed, the unused temporary variable is also removed. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Acked-by: Paul E. McKenney Cc: Marc Zyngier Cc: Peter Zijlstra Cc: Thomas Gleixner --- kernel/irq/chip.c | 15 +++------------ kernel/irq/handle.c | 4 +--- kernel/irq/internals.h | 28 ++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 7f04c7d8296e..804c2791315d 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -741,16 +741,13 @@ void handle_fasteoi_nmi(struct irq_desc *desc) struct irq_chip *chip = irq_desc_get_chip(desc); struct irqaction *action = desc->action; unsigned int irq = irq_desc_get_irq(desc); - irqreturn_t res; __kstat_incr_irqs_this_cpu(desc); - trace_irq_handler_entry(irq, action); /* * NMIs cannot be shared, there is only one action. */ - res = action->handler(irq, action->dev_id); - trace_irq_handler_exit(irq, action, res); + handle_irqaction(irq, action); if (chip->irq_eoi) chip->irq_eoi(&desc->irq_data); @@ -914,7 +911,6 @@ void handle_percpu_devid_irq(struct irq_desc *desc) struct irq_chip *chip = irq_desc_get_chip(desc); struct irqaction *action = desc->action; unsigned int irq = irq_desc_get_irq(desc); - irqreturn_t res; /* * PER CPU interrupts are not serialized. Do not touch @@ -926,9 +922,7 @@ void handle_percpu_devid_irq(struct irq_desc *desc) chip->irq_ack(&desc->irq_data); if (likely(action)) { - trace_irq_handler_entry(irq, action); - res = action->handler(irq, raw_cpu_ptr(action->percpu_dev_id)); - trace_irq_handler_exit(irq, action, res); + handle_irqaction_percpu_devid(irq, action); } else { unsigned int cpu = smp_processor_id(); bool enabled = cpumask_test_cpu(cpu, desc->percpu_enabled); @@ -957,13 +951,10 @@ void handle_percpu_devid_fasteoi_nmi(struct irq_desc *desc) struct irq_chip *chip = irq_desc_get_chip(desc); struct irqaction *action = desc->action; unsigned int irq = irq_desc_get_irq(desc); - irqreturn_t res; __kstat_incr_irqs_this_cpu(desc); - trace_irq_handler_entry(irq, action); - res = action->handler(irq, raw_cpu_ptr(action->percpu_dev_id)); - trace_irq_handler_exit(irq, action, res); + handle_irqaction_percpu_devid(irq, action); if (chip->irq_eoi) chip->irq_eoi(&desc->irq_data); diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 221d80c31e94..dbe5c9277dd7 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c @@ -152,9 +152,7 @@ irqreturn_t __handle_irq_event_percpu(struct irq_desc *desc, unsigned int *flags !(action->flags & (IRQF_NO_THREAD | IRQF_PERCPU | IRQF_ONESHOT))) lockdep_hardirq_threaded(); - trace_irq_handler_entry(irq, action); - res = action->handler(irq, action->dev_id); - trace_irq_handler_exit(irq, action, res); + res = handle_irqaction(irq, action); if (WARN_ONCE(!irqs_disabled(),"irq %u handler %pS enabled interrupts\n", irq, action->handler)) diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index 54363527feea..70a4694cc891 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h @@ -11,6 +11,8 @@ #include #include +#include + #ifdef CONFIG_SPARSE_IRQ # define IRQ_BITMAP_BITS (NR_IRQS + 8196) #else @@ -107,6 +109,32 @@ irqreturn_t __handle_irq_event_percpu(struct irq_desc *desc, unsigned int *flags irqreturn_t handle_irq_event_percpu(struct irq_desc *desc); irqreturn_t handle_irq_event(struct irq_desc *desc); +static inline irqreturn_t __handle_irqaction(unsigned int irq, + struct irqaction *action, + void *dev_id) +{ + irqreturn_t res; + + trace_irq_handler_entry(irq, action); + res = action->handler(irq, dev_id); + trace_irq_handler_exit(irq, action, res); + + return res; +} + +static inline irqreturn_t handle_irqaction(unsigned int irq, + struct irqaction *action) +{ + return __handle_irqaction(irq, action, action->dev_id); +} + +static inline irqreturn_t handle_irqaction_percpu_devid(unsigned int irq, + struct irqaction *action) +{ + return __handle_irqaction(irq, action, + raw_cpu_ptr(action->percpu_dev_id)); +} + /* Resending of interrupts :*/ int check_irq_resend(struct irq_desc *desc, bool inject); bool irq_wait_for_poll(struct irq_desc *desc); -- 2.11.0