All of lore.kernel.org
 help / color / mirror / Atom feed
* runtime_pm_get_sync() from ISR with IRQs disabled?
@ 2010-09-24  0:05 Kevin Hilman
  2010-09-24 15:13 ` Alan Stern
  2010-09-24 15:13 ` [linux-pm] " Alan Stern
  0 siblings, 2 replies; 144+ messages in thread
From: Kevin Hilman @ 2010-09-24  0:05 UTC (permalink / raw)
  To: linux-pm; +Cc: Partha Basak, linux-omap

Hello,

Looking for advice for a little runtime PM dilemma...

After some inactivity, a driver decides to supend iteslf using
pm_runtime_put_sync().

The device is now suspended, it's ->runtime_suspend() method has
disabled its clock, so its registers cannot be accessed anymore.

Now, as interrupts are still enabled, an interrupt for this device might
still arrive.  For example, if this device is a wakeup source, its
->runtime_suspend() method may not have masked its interrupt.

So, the IRQ fires, and the drivers ISR is called.  The driver wants to
access the device registers, but since it has been runtime suspended,
it's registers are not available.

The first reflex would be to simply do a pm_runtime_get_sync() in the
ISR, however this is not safe if the ISR is an IRQs-disabled handler (as
is the case for me, where the problematic handler is chained handler
used for demuxing GPIO IRQs.)

So, what is the "right" thing to do here?

A quick hack would be to for the drivers ISR to do a
pm_runtime_get_noresume() and directly call the its ->runtime_resume()
method, then do its normal stuff, followed by a pm_runtime_put() at the
end of the ISR.

Is this an acceptable hack given that it's only needed for the
increasingly rare cases of ISRs with interrupts disabled?

Or should we think of making a version of _get_sync() that is safe for
IRQs disabled contexts like this where we know the device is already
RPM_SUSPENDED?

Any advice appreciated...

Kevin

^ permalink raw reply	[flat|nested] 144+ messages in thread

end of thread, other threads:[~2011-04-11 18:37 UTC | newest]

Thread overview: 144+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-24  0:05 runtime_pm_get_sync() from ISR with IRQs disabled? Kevin Hilman
2010-09-24 15:13 ` Alan Stern
2010-09-24 15:13 ` [linux-pm] " Alan Stern
2010-09-24 18:54   ` Kevin Hilman
2010-09-24 18:54   ` [linux-pm] " Kevin Hilman
2010-09-24 20:04     ` Rafael J. Wysocki
2010-09-27 13:57       ` Alan Stern
2010-09-27 13:57       ` [linux-pm] " Alan Stern
2010-09-27 20:00         ` Rafael J. Wysocki
2010-09-27 20:39           ` Alan Stern
2010-09-27 20:39           ` [linux-pm] " Alan Stern
2010-09-27 21:09             ` Rafael J. Wysocki
2010-09-28 14:55               ` Alan Stern
2010-09-28 14:55               ` [linux-pm] " Alan Stern
2010-09-28 18:19                 ` Rafael J. Wysocki
2010-09-30 18:25                   ` [PATCH] PM: add synchronous runtime interface for interrupt handlers Alan Stern
2010-09-30 18:25                   ` Alan Stern
2010-09-30 20:15                     ` Rafael J. Wysocki
2010-09-30 20:15                     ` Rafael J. Wysocki
2010-09-30 21:42                       ` Alan Stern
2010-09-30 22:41                         ` Rafael J. Wysocki
2010-09-30 22:41                         ` Rafael J. Wysocki
2010-10-01 14:28                           ` Alan Stern
2010-10-01 21:23                             ` Rafael J. Wysocki
2010-10-02 14:12                               ` Alan Stern
2010-10-02 22:06                                 ` Rafael J. Wysocki
2010-10-02 22:06                                 ` Rafael J. Wysocki
2010-10-03 15:52                                   ` Alan Stern
2010-10-03 15:52                                   ` Alan Stern
2010-10-03 20:33                                     ` Rafael J. Wysocki
2010-10-03 20:33                                     ` Rafael J. Wysocki
2010-10-08 23:24                                   ` PATCH: PM / Runtime: Remove idle notification after failing suspend (was: Re: [PATCH] PM: add synchronous ...) Rafael J. Wysocki
2010-10-08 23:24                                   ` PATCH: PM / Runtime: Remove idle notification after failing suspend (was: Re: [linux-pm] " Rafael J. Wysocki
2010-10-10 20:18                                     ` Alan Stern
2010-10-10 20:18                                     ` PATCH: PM / Runtime: Remove idle notification after failing suspend (was: " Alan Stern
2010-10-05 21:44                                 ` [PATCH] PM: add synchronous runtime interface for interrupt handlers Kevin Hilman
2010-10-05 21:44                                 ` Kevin Hilman
2010-10-06 15:58                                   ` Alan Stern
2010-10-06 19:33                                     ` Rafael J. Wysocki
2010-10-06 19:33                                     ` Rafael J. Wysocki
2010-10-06 19:35                                     ` Kevin Hilman
2010-10-06 19:35                                     ` Kevin Hilman
2010-10-06 20:28                                       ` Alan Stern
2010-10-06 21:47                                         ` Rafael J. Wysocki
2010-10-07 15:26                                           ` Alan Stern
2010-10-07 15:26                                           ` Alan Stern
2010-10-07 16:52                                             ` Kevin Hilman
2010-10-07 17:35                                               ` Alan Stern
2010-10-07 17:35                                               ` Alan Stern
2010-10-07 21:11                                                 ` Rafael J. Wysocki
2010-10-07 23:15                                                   ` Kevin Hilman
2010-10-07 23:37                                                     ` Rafael J. Wysocki
2010-10-07 23:55                                                       ` Kevin Hilman
2010-10-07 23:55                                                       ` Kevin Hilman
2010-10-08 16:22                                                         ` Alan Stern
2010-10-08 16:22                                                         ` Alan Stern
2010-10-08 21:04                                                           ` Kevin Hilman
2010-10-08 21:04                                                           ` Kevin Hilman
2010-10-08 19:57                                                         ` Rafael J. Wysocki
2010-10-08 19:57                                                         ` Rafael J. Wysocki
2010-10-07 23:37                                                     ` Rafael J. Wysocki
2010-10-07 23:15                                                   ` Kevin Hilman
2010-10-08 16:18                                                   ` Alan Stern
2010-10-08 19:53                                                     ` Rafael J. Wysocki
2010-10-08 19:53                                                     ` Rafael J. Wysocki
2010-10-09 11:09                                                       ` Rafael J. Wysocki
2010-10-09 11:09                                                       ` [linux-pm] " Rafael J. Wysocki
2010-10-11 17:00                                                         ` Alan Stern
2010-10-11 17:00                                                         ` [linux-pm] " Alan Stern
2010-10-11 22:30                                                           ` Rafael J. Wysocki
2010-10-11 22:30                                                           ` [linux-pm] " Rafael J. Wysocki
2010-10-08 16:18                                                   ` Alan Stern
2010-10-07 21:11                                                 ` Rafael J. Wysocki
2010-10-07 16:52                                             ` Kevin Hilman
2010-11-19 15:45                                           ` [PATCH ver. 2] " Alan Stern
2010-11-20 12:56                                             ` Rafael J. Wysocki
2010-11-20 16:59                                               ` Alan Stern
2010-11-20 16:59                                               ` Alan Stern
2010-11-20 19:41                                                 ` [linux-pm] " Alan Stern
2010-11-21 23:45                                                   ` Rafael J. Wysocki
2010-11-21 23:45                                                   ` Rafael J. Wysocki
2010-11-20 19:41                                                 ` Alan Stern
2010-11-21 23:41                                                 ` Rafael J. Wysocki
2010-11-21 23:41                                                 ` Rafael J. Wysocki
2010-11-22 15:38                                                   ` Alan Stern
2010-11-22 23:01                                                     ` Rafael J. Wysocki
2010-11-23  3:19                                                       ` Alan Stern
2010-11-23  3:19                                                       ` Alan Stern
2010-11-23 22:51                                                         ` Rafael J. Wysocki
2010-11-24  0:11                                                           ` Kevin Hilman
2010-11-24  0:11                                                           ` Kevin Hilman
2010-11-24 16:43                                                             ` Alan Stern
2010-11-24 18:03                                                               ` Kevin Hilman
2010-11-24 18:03                                                               ` Kevin Hilman
2010-11-24 16:43                                                             ` Alan Stern
2010-11-24 14:56                                                           ` Alan Stern
2010-11-24 14:56                                                           ` Alan Stern
2010-11-24 20:33                                                             ` Rafael J. Wysocki
2010-11-24 20:33                                                             ` Rafael J. Wysocki
2010-11-25 15:52                                                               ` [PATCH ver. 3] " Alan Stern
2010-11-25 15:52                                                               ` Alan Stern
2010-11-25 18:58                                                                 ` Oliver Neukum
2010-11-25 18:58                                                                 ` [linux-pm] " Oliver Neukum
2010-11-25 20:03                                                                   ` Rafael J. Wysocki
2010-11-25 20:03                                                                   ` [linux-pm] " Rafael J. Wysocki
2010-11-26 22:23                                                                 ` Rafael J. Wysocki
2010-11-26 22:23                                                                 ` Rafael J. Wysocki
2010-11-23 22:51                                                         ` [PATCH ver. 2] " Rafael J. Wysocki
2010-11-22 23:01                                                     ` Rafael J. Wysocki
2010-11-22 15:38                                                   ` Alan Stern
2010-11-20 12:56                                             ` Rafael J. Wysocki
2010-11-19 15:45                                           ` Alan Stern
2011-04-11 15:47                                             ` Sylwester Nawrocki
2011-04-11 16:08                                               ` Alan Stern
2011-04-11 17:20                                                 ` Sylwester Nawrocki
2011-04-11 18:37                                                   ` Alan Stern
2010-10-06 21:47                                         ` [PATCH] " Rafael J. Wysocki
2010-10-06 23:51                                         ` Kevin Hilman
2010-10-06 23:51                                         ` Kevin Hilman
2010-10-06 20:28                                       ` Alan Stern
2010-10-06 15:58                                   ` Alan Stern
2010-10-02 14:12                               ` Alan Stern
2010-10-01 14:28                           ` Alan Stern
2010-09-30 21:42                       ` Alan Stern
2010-09-30 21:42                       ` Alan Stern
2010-09-30 22:02                     ` Rafael J. Wysocki
2010-10-01 14:12                       ` Alan Stern
2010-10-01 21:14                         ` Rafael J. Wysocki
2010-10-01 22:37                           ` [PATCH] PM / Runtime: Reduce code duplication in core helper functions (was: Re: [linux-pm] [PATCH] PM: add synchronous ...) Rafael J. Wysocki
2010-10-02 14:15                             ` Alan Stern
2010-10-02 14:15                             ` [PATCH] PM / Runtime: Reduce code duplication in core helper functions (was: " Alan Stern
2010-10-01 22:37                           ` Rafael J. Wysocki
2010-10-01 21:14                         ` [PATCH] PM: add synchronous runtime interface for interrupt handlers Rafael J. Wysocki
2010-10-01 14:12                       ` Alan Stern
2010-09-28 18:19                 ` runtime_pm_get_sync() from ISR with IRQs disabled? Rafael J. Wysocki
2010-09-27 21:09             ` Rafael J. Wysocki
2010-09-27 21:11             ` [linux-pm] " Kevin Hilman
2010-09-27 21:11             ` Kevin Hilman
2010-09-27 20:00         ` Rafael J. Wysocki
2010-09-24 20:04     ` Rafael J. Wysocki
2010-09-24 20:27     ` Alan Stern
2010-09-24 20:27     ` [linux-pm] " Alan Stern
2010-09-24 21:52       ` Kevin Hilman
2010-09-24 21:52       ` [linux-pm] " Kevin Hilman

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.