mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arve Hjønnevåg" <arve@android.com>
To: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	linux-pm@lists.linux-foundation.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] genirq: ensure IRQs are lazy disabled before suspend
Date: Thu, 7 May 2009 14:52:03 -0700	[thread overview]
Message-ID: <d6200be20905071452t3efb67gffd4de5332e83e73@mail.gmail.com> (raw)
In-Reply-To: <87k54ssx65.fsf@deeprootsystems.com>

On Thu, May 7, 2009 at 9:19 AM, Kevin Hilman
<khilman@deeprootsystems.com> wrote:
> From a3f359c66bd0ae1bb2603e7cf120d9d4d68591b7 Mon Sep 17 00:00:00 2001
> From: Kevin Hilman <khilman@deeprootsystems.com>
> Date: Wed, 6 May 2009 16:00:07 -0700
> Subject: [PATCH] genirq: ensure IRQs are lazy disabled before suspend
>
> 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 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.)

If the interrupt contoller uses the same enable register for wakeup
and interrupts, I think it is the responsibility of the platform code,
not individual drivers, to disable the interrupts that are not marked
for wakeup before entering suspend.

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

This will create a window where wakeup interrupts can be lost if the
driver has masked the interrupt (by calling disable_irq). If the
hardware does not allow edge detection on disabled interrupts (the msm
platform has this limitation) then this change will turn off the edge
detection. If suspend_ops->enter does not turn the interrupt (and edge
detection) back on (without this change it may never need to turn on
any interrupt) it will not wakeup at all.

> 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 |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 2734eca..c786820 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -190,6 +190,13 @@ 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>



-- 
Arve Hjønnevåg

  reply	other threads:[~2009-05-07 21:52 UTC|newest]

Thread overview: 9+ 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 16:19     ` Kevin Hilman
2009-05-07 21:52       ` Arve Hjønnevåg [this message]
2009-05-08 23:33         ` Kevin Hilman
2009-05-08 23:58           ` Arve Hjønnevåg
2009-05-11 21:46             ` Kevin Hilman
2009-05-11 21:47             ` Kevin Hilman

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=d6200be20905071452t3efb67gffd4de5332e83e73@mail.gmail.com \
    --to=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=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

all inboxes | Powered by JetHome®