All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Kevin Hilman <khilman@deeprootsystems.com>,
	Linux-pm mailing list <linux-pm@lists.linux-foundation.org>,
	Partha Basak <p-basak2@ti.com>,
	linux-omap@vger.kernel.org
Subject: Re: [PATCH] PM: add synchronous runtime interface for interrupt handlers
Date: Wed, 6 Oct 2010 23:47:18 +0200	[thread overview]
Message-ID: <201010062347.18232.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1010061609060.2047-100000@iolanthe.rowland.org>

On Wednesday, October 06, 2010, Alan Stern wrote:
> On Wed, 6 Oct 2010, Kevin Hilman wrote:
> 
> > >> I think I can live with the above restrictions (the _irq methods failing
> > >> unless they can immediately run.)  For the rare corner cases I've
> > >> currently run into, this will work fine as they happen because of a
> > >> wakeup IRQ, where we know the device is RPM_SUSPENDED.
> > >
> > > Then what will the driver do if it gets a wakeup IRQ but it can't
> > > resume the device because some other thread is in the middle of a
> > > suspend or resume?
> > 
> > In those cases, I guess it will have to return IRQ_NONE, and print some
> > sort of error.
> 
> Without handling the IRQ?  I guess if the transient state (SUSPENDING
> or RESUMING) ends quickly enough then the kernel won't permanently
> disable the IRQ line (although getting hundreds of repeated error
> messages in the system log might prove daunting).  Would you want to 
> rely on that?
> 
> >  Alternatively, it could fall back to the high-latency
> > case of masking the IRQ and doing an asynchronous call then call the ISR
> > in the runtime_resume callback.
> 
> Yes, this probably would be acceptable since it wouldn't happen very 
> often.  Still, having two different pathways (one of which is very low 
> probability) usually isn't a good idea.
> 
> > For the corner cases that I've run into, other transitions will not be
> > in progress because system has just woken up (so no threads are in the
> > middle of suspends or resumes) and the IRQ fires as soon as pm_idle
> > enables interrupts, and before there's a chance to schedule anything
> > else.
> 
> Ah, but once you integrate the runtime PM framework into your driver, 
> you run the risk of resumes occurring for reasons that aren't under 
> your control.  For example, the user can force a runtime-suspended 
> device to resume by writing "on" to the device's power/control sysfs 
> attribute.  What would happen if a wakeup IRQ arrived just as the 
> resume was starting?

Defer the resume.  That's the only thing you can do in any case, whether you're
going to busy loop or just use a workqueue.

> (Actually, this particular failure mode shouldn't concern you very much
> since it applies only to SMP systems.  But it's important to think of
> the future -- I can imagine SMP OMAPs coming out before too long.)
> 
> On the whole, I don't see any striking reason for the PM core not to 
> busy-wait during a concurrent state change.

I do.  That shouldn't happen in a fast path and we're talking about one,
aren't we?  Besides, I don't like busy waiting as a rule.

> Refusing to wake up a 
> suspended parent ... okay, maybe that's a little more defensible.  
> Especially since in many or most cases the parent (if there is one) 
> will probably be runtime-PM-disabled anyway.

Either we do that, or we _must_ require that the parent's resume be irq-safe
(and the same for all the parents up in the device chain).

Overall, we seem to have a corner case to cover and we're considering doing
intrusive changes to the framework because of that, even though that changes
may not be really necessary in practice.  I think we should focus more on the
corner case instead.

Thanks,
Rafael

  reply	other threads:[~2010-10-06 21:48 UTC|newest]

Thread overview: 144+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-24 20:04     ` [linux-pm] " Rafael J. Wysocki
2010-09-27 13:57       ` Alan Stern
2010-09-27 20:00         ` Rafael J. Wysocki
2010-09-27 20:00         ` [linux-pm] " Rafael J. Wysocki
2010-09-27 20:39           ` 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-28 18:19                 ` [linux-pm] " Rafael J. Wysocki
2010-09-30 18:25                   ` [PATCH] PM: add synchronous runtime interface for interrupt handlers 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 21:42                       ` Alan Stern
2010-09-30 21:42                       ` Alan Stern
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 20:33                                     ` Rafael J. Wysocki
2010-10-03 20:33                                     ` Rafael J. Wysocki
2010-10-03 15:52                                   ` Alan Stern
2010-10-08 23:24                                   ` PATCH: PM / Runtime: Remove idle notification after failing suspend (was: Re: [linux-pm] [PATCH] PM: add synchronous ...) 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-08 23:24                                   ` Rafael J. Wysocki
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 [this message]
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 21:11                                                 ` Rafael J. Wysocki
2010-10-07 23:15                                                   ` Kevin Hilman
2010-10-07 23:37                                                     ` Rafael J. Wysocki
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 21:04                                                           ` Kevin Hilman
2010-10-08 21:04                                                           ` Kevin Hilman
2010-10-08 16:22                                                         ` Alan Stern
2010-10-08 19:57                                                         ` Rafael J. Wysocki
2010-10-08 19:57                                                         ` 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-09 11:09                                                       ` [linux-pm] " Rafael J. Wysocki
2010-10-11 17:00                                                         ` Alan Stern
2010-10-11 22:30                                                           ` Rafael J. Wysocki
2010-10-11 22:30                                                           ` Rafael J. Wysocki
2010-10-11 17:00                                                         ` Alan Stern
2010-10-09 11:09                                                       ` Rafael J. Wysocki
2010-10-08 19:53                                                     ` Rafael J. Wysocki
2010-10-08 16:18                                                   ` Alan Stern
2010-10-07 21:11                                                 ` Rafael J. Wysocki
2010-10-07 17:35                                               ` Alan Stern
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 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 15:38                                                   ` Alan Stern
2010-11-22 23:01                                                     ` Rafael J. Wysocki
2010-11-22 23:01                                                     ` Rafael J. Wysocki
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 16:43                                                             ` Alan Stern
2010-11-24 16:43                                                             ` Alan Stern
2010-11-24 18:03                                                               ` Kevin Hilman
2010-11-24 18:03                                                               ` Kevin Hilman
2010-11-24  0:11                                                           ` Kevin Hilman
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                                                                   ` Rafael J. Wysocki
2010-11-26 22:23                                                                 ` Rafael J. Wysocki
2010-11-26 22:23                                                                 ` Rafael J. Wysocki
2010-11-24 14:56                                                           ` [PATCH ver. 2] " Alan Stern
2010-11-23 22:51                                                         ` Rafael J. Wysocki
2010-11-23  3:19                                                       ` Alan Stern
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 22:41                         ` Rafael J. Wysocki
2010-09-30 22:02                     ` Rafael J. Wysocki
2010-10-01 14:12                       ` Alan Stern
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: [PATCH] PM: add synchronous ...) Rafael J. Wysocki
2010-10-01 22:37                           ` [PATCH] PM / Runtime: Reduce code duplication in core helper functions (was: Re: [linux-pm] " Rafael J. Wysocki
2010-10-02 14:15                             ` [PATCH] PM / Runtime: Reduce code duplication in core helper functions (was: " Alan Stern
2010-10-02 14:15                             ` [PATCH] PM / Runtime: Reduce code duplication in core helper functions (was: Re: [linux-pm] " Alan Stern
2010-10-01 21:14                         ` [PATCH] PM: add synchronous runtime interface for interrupt handlers Rafael J. Wysocki
2010-09-30 18:25                   ` Alan Stern
2010-09-27 21:09             ` runtime_pm_get_sync() from ISR with IRQs disabled? Rafael J. Wysocki
2010-09-27 21:11             ` [linux-pm] " Kevin Hilman
2010-09-27 21:11             ` Kevin Hilman
2010-09-27 20:39           ` Alan Stern
2010-09-27 13:57       ` 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
2010-09-24 20:27     ` Alan Stern

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=201010062347.18232.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=p-basak2@ti.com \
    --cc=stern@rowland.harvard.edu \
    /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.