Re: [PATCH v3 1/2] irq: abstract irqaction handler invocation
From: Peter Zijlstra
Date: Thu Jul 15 2021 - 06:50:07 EST
On Thu, Jul 15, 2021 at 10:50:30AM +0100, Mark Rutland wrote:
> 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 <linux/pm_runtime.h>
> #include <linux/sched/clock.h>
>
> +#include <trace/events/irq.h>
> +
> #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));
> +}
So I like this patch, it's a nice cleanup.
However, you could implement the next patch as a module that hooks into
those two tracepoints. Quite possibly the existing IRQ latency tracer
would already work for what you need and also provide you a function
trace of WTH the CPU was doing.