mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Kevin Hilman <khilman@deeprootsystems.com>
Cc: "Arve Hjønnevåg" <arve@android.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	linux-pm@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Ingo Molnar" <mingo@elte.hu>
Subject: Re: [PATCH] PM: suspend_device_irqs(): don't disable wakeup IRQs
Date: Thu, 7 May 2009 13:54:07 +0200	[thread overview]
Message-ID: <200905071354.08319.rjw@sisk.pl> (raw)
In-Reply-To: <87zldpu5rt.fsf@deeprootsystems.com>

On Thursday 07 May 2009, Kevin Hilman wrote:
> "Rafael J. Wysocki" <rjw@sisk.pl> writes:
> 
> > On Wednesday 06 May 2009, Kevin Hilman wrote:
> >> Kevin Hilman <khilman@deeprootsystems.com> writes:
> >> 
> >> > "Rafael J. Wysocki" <rjw@sisk.pl> writes:
> >> >
> >> >> On Wednesday 06 May 2009, Kevin Hilman wrote:
> >> 
> >> [...]
> >> 
> >> >>> 
> >> >>> [...]
> >> >>> 
> >> >>> >>>
> >> >>> >>> If this fixes some bug then please provide a description of that bug?
> >> >>> >>
> >> >>> >> The bug is that on TI OMAP, interrupts that are used for wakeup events
> >> >>> >> are disabled by this code causing the system to no longer wake up.
> >> >>> >
> >> >>> > What do you do if the interrupt triggers right after your driver has
> >> >>> > returned from its late suspend hook?  
> >> >>> 
> >> >>> If it's a wakeup IRQ, I assume you want it to prevent suspend.
> >> >>> 
> >> >>> But I don't see how that can happen in the current code. IIUC, by the
> >> >>> time your late suspend hook is run, your device IRQ is already
> >> >>> disabled, so it won't trigger an interrupt that will be caught by
> >> >>> check_wakeup_irqs() anyways.
> >> >>
> >> >> My understanding of __disable_irq() was that it didn't actually disable the
> >> >> IRQ at the hardware level, allowing the CPU to actually receive the interrupt
> >> >> and acknowledge it, but preventing the device driver for receiving it.  
> >> >
> >> >> Does it work differently on the affected systems?
> >> >
> >> > Yes.
> >> >
> >> > __disable_irq() calls the irq_chip's disable method which is platform
> >> > specific.  On OMAP, this masks the IRQ at the hardware level
> >> > preventing the CPU from seeing the interrupt.
> >> 
> >> Looking at x86, the i8259 disable hook also seems to mask the IRQ at
> >> the PIC level.
> >> 
> >> The various IO-APIC irq_chips do not have a disable hook so the
> >> __disable_irq() here is a NOP.
> >
> > Except that it sets IRQ_DISABLED.
> >
> > All right there.
> 
> OK, right. I missed the setting of IRQ_DISABLED there.
> 
> > We can either avoid disabling wake-up interrupts, in which case we
> > should drop check_wakeup_irqs() IMO, or rework things so that
> > check_wakeup_irqs() will catch them.  Doing both doesn't seem to
> > make sense to me.
> >
> > Which one would be the right approach, then?
> 
> Not sure if there is right one as they are solving two different
> problems.
> 
> check_wakeup_irqs() seems meant to address handling interrupts that
> happen during the suspend path.  My fix for not disabling wakups is
> meant to allow those interrupts after suspend.

Still, with your fix in place, check_wakeup_irqs() is useless, because
the wake-up interrupts are not going to have IRQ_PENDING set.

> An alternative to my original approach is the one taken on x86
> IO-APICs where the irq_chip's disable hook is empty, thus not masking
> in HW but still preventing the ISR from running.

That sounds quite right.

> I need to explore whether just dropping the irq_chip's disable hook
> would work for us on OMAP.
> 
> There is at least one problem with that which is why Kyuwon Kim added
> the ->disable hook to OMAP's irq_chip.  The problem is with drivers
> that call disable_irq() in their suspend hook, usually done to prevent
> the device from waking the system since on OMAP, any IRQ can be
> configured to wake the system.
> 
> If a driver's suspend hook calls disable_irq() and the system is
> suspended before the lazy disable happens in the next handler, then
> the system will be suspended with that device's IRQ still enabled.
> Without an irq_chip->disable hook, that will result in that device IRQ
> waking up the system if it fires.
> 
> I now have a patch for this which ensures that the lazy-disable
> happens in the suspend path using the ->mask hook just like
> it does in the handler.  Will send to LKML and here shortly.

Great, thanks!

Best,
Rafael

  parent reply	other threads:[~2009-05-07 11:55 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-05  0:27 Kevin Hilman
2009-05-05  6:54 ` Andrew Morton
2009-05-05 14:11   ` [linux-pm] " Vitaly Wool
2009-05-05 15:56     ` Kevin Hilman
2009-05-05 15:52   ` Kevin Hilman
2009-05-05 20:58     ` Arve Hjønnevåg
2009-05-05 23:15       ` Kevin Hilman
2009-05-05 23:27         ` Rafael J. Wysocki
2009-05-05 23:51           ` Arve Hjønnevåg
2009-05-06  0:13           ` Kevin Hilman
2009-05-06  0:38             ` Kevin Hilman
2009-05-06  0:45               ` Kevin Hilman
2009-05-06 14:04             ` Kevin Hilman
2009-05-06 21:18               ` Rafael J. Wysocki
2009-05-07  0:16                 ` Kevin Hilman
2009-05-07  1:18                   ` Arve Hjønnevåg
2009-05-07  1:28                     ` Kim Kyuwon
2009-05-07  1:44                       ` Arve Hjønnevåg
2009-05-07  2:04                         ` Kim Kyuwon
2009-05-07 14:13                           ` Kevin Hilman
2009-05-07 11:54                   ` Rafael J. Wysocki [this message]
2009-05-06  0:20           ` Kim Kyuwon
2009-05-22  2:53           ` Kim Kyuwon
2009-05-22 16:04             ` Kim Kyuwon
2009-05-22 21:25               ` Rafael J. Wysocki
2009-05-22 22:32                 ` Kim Kyuwon
2009-05-22 23:47                   ` Rafael J. Wysocki
2009-05-23  0:42                     ` Kim Kyuwon
2009-05-22 21:23             ` Rafael J. Wysocki
2009-05-22 22:24               ` Kim Kyuwon
2009-05-22 22:29                 ` Rafael J. Wysocki
2009-05-22 23:03                   ` Kim Kyuwon
2009-05-23 20:14                     ` Rafael J. Wysocki
2009-05-25  7:02                       ` Kim Kyuwon
2009-05-29 23:35                         ` Rafael J. Wysocki
2009-05-30  7:34                           ` Kim Kyuwon
2009-05-30  7:40                             ` Kim Kyuwon
2009-05-30 21:00                             ` Rafael J. Wysocki
2009-05-05 23:57         ` Arve Hjønnevåg

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=200905071354.08319.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=akpm@linux-foundation.org \
    --cc=arve@android.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.org \
    /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

all inboxes | Powered by JetHome®