Re: [PATCH] genirq: Fix gpio irq will fail to be resend under certain conditions

From: Thomas Gleixner
Date: Mon Jun 10 2024 - 15:25:51 EST


Zhenze!

On Sun, Jun 09 2024 at 00:36, Zhenze Zhuang wrote:

This has nothing to do with GPIO interrupts. It's a general problem
vs. resend, no?

> When a gpio irq is disable and the wakeup function is enable, and
> the device enters suspend, the irq wakeup is triggered but then enters
> suspend, the IRQS_REPLAY flag will be set, but the IRQS_REPLAY will
> not be cleared because the irq_may_run() condition is not met. After
> the gpio irq is enabled and the suspend is entered again, after the
> gpio irq is triggered, the check_irq_resend() execution will fail
> because the IRQS_REPLAY is asserted, resulting in the interrupt not
> being resned.

The concept of separate sentences and paragrahs exists for a reason.

https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#changelog

No let me break that world salad apart and digest it.

> When a gpio irq is disable and the wakeup function is enable, and
> the device enters suspend, the irq wakeup is triggered but then enters
> suspend, the IRQS_REPLAY flag will be set, but the IRQS_REPLAY will
> not be cleared because the irq_may_run() condition is not met.

So what you are saying is:

An interrupt is disabled, but the wakeup function of the interrupt is
enabled, right?

Now the system enters suspend and the interrupt is raised, which
triggers the wakeup function, right?

Now the system enters suspend nevertheless. How can that happen?

Due to that the IRQS_REPLAY flag will be set. How so? IRQS_REPLAY is
only set from the resend function.

Due to that IRQS_REPLAY will not be cleared because the irq_may_run()
condition is not cleared. Sure, but how does any of this happen in the
first place?

> After the gpio irq is enabled and the suspend is entered again, after
> the gpio irq is triggered, the check_irq_resend() execution will fail
> because the IRQS_REPLAY is asserted, resulting in the interrupt not
> being resned.

This sentence really makes my brain go in circles. None of this change
log makes any sense.

Before you send me a decipherable description of the problem, let me ask
you a few obvious questions:

1) Why is the interrupt disabled _and_ marked as wakeup interrupt?

2) If it should still wakeup the system even if disabled, then the
interrupt chip should have the IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND
flag set. That's not the case, right?

Thanks,

tglx