All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: linux-kernel@vger.kernel.org
Cc: linux-pm@lists.linux-foundation.org,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>
Subject: [PATCH] genirq: ensure IRQs are lazy disabled before suspend
Date: Wed,  6 May 2009 17:17:48 -0700	[thread overview]
Message-ID: <1241655468-5750-2-git-send-email-khilman__39399.7674379081$1241655749$gmane$org@deeprootsystems.com> (raw)
In-Reply-To: <1241655468-5750-1-git-send-email-khilman@deeprootsystems.com>

In commit 76d2160147f43f982dfe881404cfde9fd0a9da21, the default
behavior of disable_irq() was changed to delay the disable until it is
next handled.

However, this leaves open the possibility that the system can go into
suspend with an interrupt enabled.  For example, if a driver calls
disable_irq() in its suspend_hook (for example, to prevent that device
IRQ from causing a system wakeup) there's now a possibility that the
system is suspended before the lazy disable happens.

The result is an unwanted wakeup from suspend if the IRQ is capable of
waking the system (common on embedded SoCs.)

This patch ensures that the lazy disable is done, and masked by
the irq_chip before the system goes into suspend.

Note that even though __disable_irq() also calls irq_chip->disable, it
is quite common for the irq_chip not to provide a disable hook in
which case the IRQ is never masked/disabled in hardware before going
into suspend.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
 kernel/irq/manage.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 2734eca..5d2cc1c 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -190,6 +190,11 @@ void __disable_irq(struct irq_desc *desc, unsigned int irq, bool suspend)
 		if (!desc->action || (desc->action->flags & IRQF_TIMER))
 			return;
 		desc->status |= IRQ_SUSPENDED;
+
+		/* Lazy disable: handles case where lazy disable in
+		 * handler doesn't happen before suspend. */
+		if (desc->status & IRQ_DISABLED)
+			desc->chip->mask(irq);
 	}
 
 	if (!desc->depth++) {
-- 
1.6.2.2

      parent reply	other threads:[~2009-05-07  0:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-07  0:17 [PATCH] genirq: update irq_chip struct comment for irq_chip->disable hook Kevin Hilman
2009-05-07  0:17 ` [PATCH] genirq: ensure IRQs are lazy disabled before suspend Kevin Hilman
2009-05-07 11:15   ` Ingo Molnar
2009-05-07 11:15   ` Ingo Molnar
2009-05-07 16:19     ` Kevin Hilman
2009-05-07 16:19     ` Kevin Hilman
2009-05-07 21:52       ` Arve Hjønnevåg
2009-05-08 23:33         ` Kevin Hilman
2009-05-08 23:33         ` Kevin Hilman
2009-05-08 23:58           ` Arve Hjønnevåg
2009-05-08 23:58             ` Arve Hjønnevåg
2009-05-11 21:46             ` Kevin Hilman
2009-05-11 21:46             ` Kevin Hilman
2009-05-11 21:47             ` Kevin Hilman
2009-05-11 21:47             ` Kevin Hilman
2009-05-07 21:52       ` Arve Hjønnevåg
2009-05-07  0:17 ` Kevin Hilman [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='1241655468-5750-2-git-send-email-khilman__39399.7674379081$1241655749$gmane$org@deeprootsystems.com' \
    --to=khilman@deeprootsystems.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mingo@elte.hu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.