All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	linux-kernel@vger.kernel.org,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	linux-arm-kernel@lists.infradead.org,
	Linux PM list <linux-pm@vger.kernel.org>
Subject: Re: [PATCH] genirq / PM: Add flag for shared NO_SUSPEND interrupt lines
Date: Fri, 27 Feb 2015 09:38:59 +0100	[thread overview]
Message-ID: <20150227083859.GD21418@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <6864616.1aRDSmSsvx@vostro.rjw.lan>

On Fri, Feb 27, 2015 at 12:07:55AM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> It currently is required that all users of NO_SUSPEND interrupt
> lines pass the IRQF_NO_SUSPEND flag when requesting the IRQ or the
> WARN_ON_ONCE() in irq_pm_install_action() will trigger.  That is
> done to warn about situations in which unprepared interrupt handlers
> may be run unnecessarily for suspended devices and may attempt to
> access those devices by mistake.  However, it may cause drivers
> that have no technical reasons for using IRQF_NO_SUSPEND to set
> that flag just because they happen to share the interrupt line
> with something like a timer.
> 
> Moreover, the generic handling of wakeup interrupts introduced by
> commit 9ce7a25849e8 (genirq: Simplify wakeup mechanism) only works
> for IRQs without any NO_SUSPEND users, so the drivers of wakeup
> devices needing to use shared NO_SUSPEND interrupt lines for
> signaling system wakeup generally have to detect wakeup in their
> interrupt handlers.  Thus if they happen to share an interrupt line
> with a NO_SUSPEND user, they also need to request that their
> interrupt handlers be run after suspend_device_irqs().
> 
> In both cases the reason for using IRQF_NO_SUSPEND is not because
> the driver in question has a genuine need to run its interrupt
> handler after suspend_device_irqs(), but because it happens to
> share the line with some other NO_SUSPEND user.  Otherwise, the
> driver would do without IRQF_NO_SUSPEND just fine.
> 
> To make it possible to specify that condition explicitly, introduce
> a new IRQ action handler flag for shared IRQs, IRQF_COND_SUSPEND,
> that, when set, will indicate to the IRQ core that the interrupt
> user is generally fine with suspending the IRQ, but it also can
> tolerate handler invocations after suspend_device_irqs() and, in
> particular, it is capable of detecting system wakeup and triggering
> it as appropriate from its interrupt handler.
> 
> That will allow us to work around a problem with a shared timer
> interrupt line on at91 platforms.
> 
> Link: http://marc.info/?l=linux-kernel&m=142252777602084&w=2
> Link: http://marc.info/?t=142252775300011&r=1&w=2
> Linx: https://lkml.org/lkml/2014/12/15/552
> Reported-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Seems good to me. Should I take this through tip/irq ?

Also, should we warn if people use enable_irq_wake() where there is only
a single descriptor with NO_SUSPEND?

WARNING: multiple messages have this Message-ID (diff)
From: peterz@infradead.org (Peter Zijlstra)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] genirq / PM: Add flag for shared NO_SUSPEND interrupt lines
Date: Fri, 27 Feb 2015 09:38:59 +0100	[thread overview]
Message-ID: <20150227083859.GD21418@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <6864616.1aRDSmSsvx@vostro.rjw.lan>

On Fri, Feb 27, 2015 at 12:07:55AM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> It currently is required that all users of NO_SUSPEND interrupt
> lines pass the IRQF_NO_SUSPEND flag when requesting the IRQ or the
> WARN_ON_ONCE() in irq_pm_install_action() will trigger.  That is
> done to warn about situations in which unprepared interrupt handlers
> may be run unnecessarily for suspended devices and may attempt to
> access those devices by mistake.  However, it may cause drivers
> that have no technical reasons for using IRQF_NO_SUSPEND to set
> that flag just because they happen to share the interrupt line
> with something like a timer.
> 
> Moreover, the generic handling of wakeup interrupts introduced by
> commit 9ce7a25849e8 (genirq: Simplify wakeup mechanism) only works
> for IRQs without any NO_SUSPEND users, so the drivers of wakeup
> devices needing to use shared NO_SUSPEND interrupt lines for
> signaling system wakeup generally have to detect wakeup in their
> interrupt handlers.  Thus if they happen to share an interrupt line
> with a NO_SUSPEND user, they also need to request that their
> interrupt handlers be run after suspend_device_irqs().
> 
> In both cases the reason for using IRQF_NO_SUSPEND is not because
> the driver in question has a genuine need to run its interrupt
> handler after suspend_device_irqs(), but because it happens to
> share the line with some other NO_SUSPEND user.  Otherwise, the
> driver would do without IRQF_NO_SUSPEND just fine.
> 
> To make it possible to specify that condition explicitly, introduce
> a new IRQ action handler flag for shared IRQs, IRQF_COND_SUSPEND,
> that, when set, will indicate to the IRQ core that the interrupt
> user is generally fine with suspending the IRQ, but it also can
> tolerate handler invocations after suspend_device_irqs() and, in
> particular, it is capable of detecting system wakeup and triggering
> it as appropriate from its interrupt handler.
> 
> That will allow us to work around a problem with a shared timer
> interrupt line on at91 platforms.
> 
> Link: http://marc.info/?l=linux-kernel&m=142252777602084&w=2
> Link: http://marc.info/?t=142252775300011&r=1&w=2
> Linx: https://lkml.org/lkml/2014/12/15/552
> Reported-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Seems good to me. Should I take this through tip/irq ?

Also, should we warn if people use enable_irq_wake() where there is only
a single descriptor with NO_SUSPEND?

  reply	other threads:[~2015-02-27  8:39 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24  9:55 [RFC PATCH 0/3] genirq: mixing IRQF_NO_SUSPEND and wakeup sources on shared IRQs Boris Brezillon
2015-02-24  9:55 ` Boris Brezillon
2015-02-24  9:56 ` [RFC PATCH 1/3] genirq: prevent system wakeup when dealing with IRQF_NO_SUSPEND IRQs Boris Brezillon
2015-02-24  9:56   ` Boris Brezillon
2015-02-25 22:01   ` Rafael J. Wysocki
2015-02-25 22:01     ` Rafael J. Wysocki
2015-02-26  8:06     ` Boris Brezillon
2015-02-26  8:06       ` Boris Brezillon
2015-02-24  9:56 ` [RFC PATCH 2/3] genirq: add helper functions to deal with wakeup on shared " Boris Brezillon
2015-02-24  9:56   ` Boris Brezillon
2015-02-25 22:03   ` Rafael J. Wysocki
2015-02-25 22:03     ` Rafael J. Wysocki
2015-02-26  8:09     ` Boris Brezillon
2015-02-26  8:09       ` Boris Brezillon
2015-02-24  9:56 ` [RFC PATCH 3/3] rtc: at91sam9: properly act when IRQ handler is called in suspended state Boris Brezillon
2015-02-24  9:56   ` Boris Brezillon
2015-02-25 22:05   ` Rafael J. Wysocki
2015-02-25 22:05     ` Rafael J. Wysocki
2015-02-26  8:12     ` Boris Brezillon
2015-02-26  8:12       ` Boris Brezillon
2015-02-25 21:59 ` [RFC PATCH 0/3] genirq: mixing IRQF_NO_SUSPEND and wakeup sources on shared IRQs Rafael J. Wysocki
2015-02-25 21:59   ` Rafael J. Wysocki
2015-02-26  8:03   ` Boris Brezillon
2015-02-26  8:03     ` Boris Brezillon
2015-02-26 15:44     ` Rafael J. Wysocki
2015-02-26 15:44       ` Rafael J. Wysocki
2015-02-26 15:47       ` Boris Brezillon
2015-02-26 15:47         ` Boris Brezillon
2015-02-26 18:17         ` Rafael J. Wysocki
2015-02-26 18:17           ` Rafael J. Wysocki
2015-02-26 18:17           ` Boris Brezillon
2015-02-26 18:17             ` Boris Brezillon
2015-02-26 21:55             ` Rafael J. Wysocki
2015-02-26 21:55               ` Rafael J. Wysocki
2015-02-26 23:07             ` [PATCH] genirq / PM: Add flag for shared NO_SUSPEND interrupt lines Rafael J. Wysocki
2015-02-26 23:07               ` Rafael J. Wysocki
2015-02-27  8:38               ` Peter Zijlstra [this message]
2015-02-27  8:38                 ` Peter Zijlstra
2015-02-27 22:13                 ` Rafael J. Wysocki
2015-02-27 22:13                   ` Rafael J. Wysocki
2015-02-27 22:11                   ` Peter Zijlstra
2015-02-27 22:11                     ` Peter Zijlstra
2015-03-04 19:42               ` Mark Rutland
2015-03-04 19:42                 ` Mark Rutland
2015-03-04 20:00                 ` [PATCH] genirq: describe IRQF_COND_SUSPEND Mark Rutland
2015-03-04 20:00                   ` Mark Rutland
2015-03-04 21:55                   ` Rafael J. Wysocki
2015-03-04 21:55                     ` Rafael J. Wysocki
2015-03-04 22:17                   ` Alexandre Belloni
2015-03-04 22:17                     ` Alexandre Belloni
2015-03-04 22:27                     ` Arnd Bergmann
2015-03-04 22:27                       ` Arnd Bergmann
2015-03-05 11:04                     ` Mark Rutland
2015-03-05 11:04                       ` Mark Rutland
2015-03-05 11:33                       ` Alexandre Belloni
2015-03-05 11:33                         ` Alexandre Belloni
2015-03-05 12:07                         ` Mark Rutland
2015-03-05 12:07                           ` Mark Rutland
2015-03-06  0:54                       ` Rafael J. Wysocki
2015-03-06  0:54                         ` Rafael J. Wysocki
2015-03-04 21:30                 ` [PATCH] genirq / PM: Add flag for shared NO_SUSPEND interrupt lines Rafael J. Wysocki
2015-03-04 21:30                   ` Rafael J. Wysocki

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=20150227083859.GD21418@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=nicolas.ferre@atmel.com \
    --cc=plagnioj@jcrosoft.com \
    --cc=rjw@rjwysocki.net \
    --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.