public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: zzz  <luuiiruo@163.com>
To: "Thomas Gleixner" <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re:Re: [PATCH] genirq: Fix gpio irq will fail to be resend under certain conditions
Date: Tue, 11 Jun 2024 23:41:53 +0800 (CST)	[thread overview]
Message-ID: <320df2de.cd42.19007f68062.Coremail.luuiiruo@163.com> (raw)
In-Reply-To: <874ja0wqfb.ffs@tglx>

tglx,
    I'm sorry for my vague description. First, let me answer your questions.

>This has nothing to do with GPIO interrupts. It's a general problem
>vs. resend, no?
Yes, i think it's a general interrupts problem, but i found it while testing gpio interrupts.

>So what you are saying is:
>An interrupt is disabled, but the wakeup function of the interrupt is
>enabled, right?
Yes.

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

>Now the system enters suspend nevertheless. How can that happen?
Although the device is woken up by gpio irq, it may re-enter suspend after some time.

>Due to that the IRQS_REPLAY flag will be set. How so? IRQS_REPLAY is
>only set from the resend function.
When entering suspend , the path is as follows:
suspend_device_irqs()
    suspend_device_irq()
        __enable_irq()
            irq_startup()
                check_irq_resend()   --IRQS_REPLAY flag is set in this 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?
I will show you a complete process.

>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?
I have a pin named DATA.
When there is no connection, DATA needs to be a recognition function, the 
interrupt enabled and wakeup are used here.
When there is connection, DATA is used communication function, the interrupt 
disabled and wakeup are used here.

>  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?
No, IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND flag will be set.


Second, I wil show you complete process by timeline:

1.device is suspend, irq disable, wakeup enable, every state is normal now;

2.device is suspend, irq disable, wakeup enable, irq raised and trigger wakeup, 
IRQS_PENDING flag will be set;

3.device is active, irq disable, wakeup enable, devices enter suspend afte some 
time, this step will executes check_irq_resend(), IRQS_REPLAY flag will be set. 
Please refer to the paths listed above.
And check_irq_resend() will call handle_fasteoi_irq(), but irq_may_run() return false,
so IRQS_REPLAY flag not be clear.

4.device is suspend, irq disable, wakeup enable, device wakeup again, we set irq 
enable, and let device enter suspend;

5.device is suspend, irq enable, wakeup enable, irq raised and trigger wakeup, will 
executes check_irq_resend(), but IRQS_REPLAY flag is set, so irq thread_fn() will not 
be executes.


Thanks!
zzz

      reply	other threads:[~2024-06-11 15:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-08 16:36 [PATCH] genirq: Fix gpio irq will fail to be resend under certain conditions Zhenze Zhuang
2024-06-10 19:25 ` Thomas Gleixner
2024-06-11 15:41   ` zzz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=320df2de.cd42.19007f68062.Coremail.luuiiruo@163.com \
    --to=luuiiruo@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox