Re: [PATCH v3 1/3] genirq: enhance error recovery code in free irq

From: Thomas Gleixner
Date: Thu Aug 15 2019 - 10:20:58 EST


On Thu, 15 Aug 2019, Ben Luo wrote:

> Per Thomas Gleixner's comments:
> 1) free_irq/free_percpu_irq returns if called from IRQ context
> 2) move WARN out of the locked region and print out dev_id

Please do not describe WHAT the patch is doing, please describe WHY.

> Signed-off-by: Ben Luo <luoben@xxxxxxxxxxxxxxxxx>
> ---
> kernel/irq/manage.c | 32 ++++++++++++++++++++------------
> 1 file changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index e8f7f17..6f9b20f 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -1690,7 +1690,11 @@ static struct irqaction *__free_irq(struct irq_desc *desc, void *dev_id)
> struct irqaction *action, **action_ptr;
> unsigned long flags;
>
> - WARN(in_interrupt(), "Trying to free IRQ %d from IRQ context!\n", irq);
> + if (in_interrupt()) {
> + WARN(1, "Trying to free IRQ %d (dev_id %p) from IRQ context!\n",
> + irq, dev_id);
> + return NULL;
> + }

if (WARN(in_interrupt(), ."Tr...."))
return NULL;

Thanks,

tglx