linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: "Ohad Ben-Cohen" <ohad@wizery.com>,
	Alan Stern <stern@rowland.harvard.edu>
Cc: linux-pm@lists.linux-foundation.org,
	Johannes Berg <johannes@sipsolutions.net>,
	linux-wireless@vger.kernel.org, linux-mmc@vger.kernel.org,
	Ido Yariv <ido@wizery.com>,
	Kevin Hilman <khilman@deeprootsystems.com>
Subject: Re: [linux-pm] subtle pm_runtime_put_sync race and sdio functions
Date: Tue, 28 Dec 2010 21:36:14 +0100	[thread overview]
Message-ID: <201012282136.14258.rjw@sisk.pl> (raw)
In-Reply-To: <AANLkTinPrUbaFsNMmoZJtOaF6dutLaXXQ7Uws5826n4=@mail.gmail.com>

On Tuesday, December 28, 2010, Ohad Ben-Cohen wrote:
> On Tue, Dec 28, 2010 at 9:21 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > It looks like you could simply do a power down-power up cycle before trying to
> > load new firmware, just in case.  I guess that's suboptimal for some reason?
> 
> It would work, but we will not be able to unconditionally disable the
> radios (e.g. airplane mode comes to mind).

For _unconditional_ disabling you need to bypass the runtime PM anyway.

I guess it's best to simply disable it and invoke whatever-function-powers-off
your device directly in those cases.

> > Please pretend that the runtime PM framework doesn't exist for a while.  How
> > would you design things in that case?
> 
> Duplicate most of runtime-PM's plumbing into the MMC/SDIO subsystem.
> Off the top of my hat:
> - We need the device hierarchy and the suspend/resume dependencies (a
> single SDIO card has several logical sub-devices, a.k.a SDIO
> functions)
> - We need to maintain usage_count for each device, and expose the same
> API to handle it
> - We need autosuspend for MMC cards (power them off on inactivity)
> - We need the same, or similar, locking plumbing
> - We probably need the same sysfs ABI as well: autosuspend_delay_ms,
> and even  /sys/devices/.../power/control itself is useful (not for our
> device, but for others, sure)
> - ...

I didn't mean that, never mind.

To solve the problem with system suspend (I think) you need to:
(1) Add a ->prepare() callback to your driver, calling pm_runtime_resume()
    for the device.  From that point on you know that its runtime callbacks
    won't be called and if all of the pm_runtime_get_* and pm_runtime_put_*
    things are in balance, everything will work out nicely during resume.
(2) Add ->suspend() and ->resume() callbacks to your driver that will
    set the device for system suspend and bring it back to the "power on"
    state during system resume (that will cover your error code path issue in
    particular).
During resume, the pm_runtime_put_sync() in dpm_complete() should put the
device back into the low power state (if it was in that state before).

Thanks,
Rafael

  reply	other threads:[~2010-12-28 20:37 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTikJr+0kVPE4aSwPjZWRfA3gRSNgGwzQdSwRpo_5@mail.gmail.com>
     [not found] ` <Pine.LNX.4.44L0.1012110937100.10743-100000@netrider.rowland.org>
     [not found]   ` <AANLkTi=32bqipN5U00La-B7JSgTC1bHgMev=xUSF6kRN@mail.gmail.com>
     [not found]     ` <201012181607.26628.rjw@sisk.pl>
2010-12-18 16:00       ` [linux-pm] subtle pm_runtime_put_sync race and sdio functions Ohad Ben-Cohen
2010-12-18 16:40         ` Johannes Berg
2010-12-18 19:08           ` Ohad Ben-Cohen
2010-12-18 21:30             ` Alan Stern
2010-12-18 22:57               ` Rafael J. Wysocki
2010-12-18 22:52             ` Rafael J. Wysocki
2010-12-18 21:29           ` Alan Stern
2010-12-18 22:50           ` Rafael J. Wysocki
2010-12-18 22:47         ` Rafael J. Wysocki
2010-12-19  7:48           ` Ohad Ben-Cohen
2010-12-19 10:22           ` Rafael J. Wysocki
2010-12-20  3:37             ` Alan Stern
2010-12-20 21:17               ` Rafael J. Wysocki
2010-12-21  0:57                 ` Alan Stern
2010-12-21 21:31                   ` Rafael J. Wysocki
2010-12-22  1:42                     ` Alan Stern
2010-12-22 12:29                       ` Rafael J. Wysocki
2011-01-26 23:28                         ` Kevin Hilman
2011-01-27 18:13                           ` Alan Stern
2011-01-27 19:22                             ` Kevin Hilman
2011-01-27 19:49                               ` Alan Stern
2011-01-27 20:15                                 ` Kevin Hilman
2011-01-27 22:18                                   ` Vitaly Wool
2011-01-27 23:21                                   ` Rafael J. Wysocki
2011-01-27 23:49                                     ` Kevin Hilman
2011-01-27 23:11                             ` Rafael J. Wysocki
2011-01-27 18:20                           ` Vitaly Wool
2011-01-27 18:54                             ` Kevin Hilman
2010-12-21 22:23             ` Kevin Hilman
2010-12-22  1:48               ` Alan Stern
2010-12-23  7:51             ` Ohad Ben-Cohen
2010-12-23 16:03               ` Alan Stern
2010-12-25  7:34                 ` Ohad Ben-Cohen
2010-12-25 16:21                   ` Alan Stern
2010-12-25 20:58                     ` Ohad Ben-Cohen
2010-12-25 21:50                       ` Vitaly Wool
2010-12-26  5:27                         ` Ohad Ben-Cohen
2010-12-25 21:54                       ` Vitaly Wool
2010-12-26  2:48                       ` Alan Stern
2010-12-26  5:55                         ` Ohad Ben-Cohen
2010-12-26 11:45                           ` Rafael J. Wysocki
2010-12-26 12:43                             ` Ohad Ben-Cohen
2010-12-26 18:35                               ` Rafael J. Wysocki
2010-12-28 19:11                                 ` Ohad Ben-Cohen
2010-12-28 19:21                                   ` Rafael J. Wysocki
2010-12-28 19:34                                     ` Ohad Ben-Cohen
2010-12-28 20:36                                       ` Rafael J. Wysocki [this message]
2010-12-26 14:53                             ` Ohad Ben-Cohen
2010-12-26 18:37                               ` Rafael J. Wysocki
2010-12-28 19:15                                 ` Ohad Ben-Cohen
2010-12-28 20:04                                   ` Rafael J. Wysocki
2010-12-28 20:41                                     ` Ohad Ben-Cohen
2010-12-26 17:00                           ` Alan Stern
2010-12-28 19:04                             ` Ohad Ben-Cohen
2010-12-28 21:46                               ` Alan Stern
2010-12-29  6:34                                 ` Ohad Ben-Cohen
2010-12-30  4:25                                   ` Alan Stern
2010-12-29  8:01                                 ` Ohad Ben-Cohen
2010-12-30  4:30                                   ` 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=201012282136.14258.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=ido@wizery.com \
    --cc=johannes@sipsolutions.net \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=ohad@wizery.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).