Re: [PATCH v3] irq/core: synchronize irq_thread startup

From: Thomas Gleixner
Date: Mon May 02 2022 - 15:25:02 EST


On Tue, May 03 2022 at 00:01, Hillf Danton wrote:
> On Mon, 02 May 2022 16:28:56 +0200 Thomas Gleixner wrote:
> --- upstream/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -1258,6 +1258,7 @@ static int irq_thread(void *data)
> struct irq_desc *desc = irq_to_desc(action->irq);
> irqreturn_t (*handler_fn)(struct irq_desc *desc,
> struct irqaction *action);
> + bool waked = false;
>
> sched_set_fifo(current);
>
> @@ -1282,8 +1283,11 @@ static int irq_thread(void *data)
> irq_wake_secondary(desc, action);
>
> wake_threads_waitq(desc);
> + waked = true;
> }
>
> + if (!waked)
> + wake_threads_waitq(desc);

That's a guarantee to make desc->threads_active go negative in the case
that the thread was never woken by a hard interrupt handler. IOW, you
created a new problem which did not exist before.

The problem discussed here is not a problem in irq_thread(), it's a
problem of not reaching this function in the first place. See the on
point analysis in Thomas Pfaffs patch.

Thanks,

tglx