All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: nigel@nigel.suspend2.net
Cc: Tilman Schmidt <tilman@imap.cc>, Pavel Machek <pavel@ucw.cz>,
	Arjan van de Ven <arjan@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: NAK new drivers without proper power management?
Date: Mon, 12 Feb 2007 21:06:25 +0100	[thread overview]
Message-ID: <200702122106.25939.rjw@sisk.pl> (raw)
In-Reply-To: <1171253309.5473.15.camel@nigel.suspend2.net>

On Monday, 12 February 2007 05:08, Nigel Cunningham wrote:
> Howdy!
> 
> On Mon, 2007-02-12 at 01:10 +0100, Tilman Schmidt wrote:
> > Hi,
> > 
> > Am 11.02.2007 23:37 schrieb Nigel Cunningham:
> > > On Sun, 2007-02-11 at 00:45 +0100, Tilman Schmidt wrote:
> > >> Am 10.02.2007 23:37 schrieb Nigel Cunningham:
> > >>> If your device requires power management, and you know it requires power
> > >>> management, why not just implement power management? [...]
> > >> Like it or not, power management is far from trivial, and people
> > >> writing device drivers have limited resources. [...]
> > > It's not that complex. All we're really talking about is a bit of extra
> > > code to cleanup and configure hardware state; things that the driver
> > > author already knows how to do. S3 might require a bit more
> > > initialisation if firmware needs to be reloaded or more extensive
> > > configuration needs to be done, but if there's firmware to be loaded,
> > > there is a reasonably good probability that we loaded it from Linux to
> > > start with anyway.
> > 
> > You are assuming a perfect world where driver authors have complete
> > knowledge of their devices. In reality, many drivers (including
> > those I have the mixed pleasure of maintaining) are based at least
> > in part on reverse engineering, and managing power states may well
> > fall into the domain of things not yet sufficiently reverse
> > engineered.
> 
> Nope. I'm assuming that the driver author knows what needs to be done to
> get the driver out of whatever state the BIOS puts it in to start with,
> and into an operational state, and that they therefore also know what
> needs to be done to take it out of the operational state again. I'm
> admitting that there's also another state - the post suspend-to-ram
> driver state - that they may not know how to deal with. But for
> suspend-to-disk, if you know how to get the driver to work in the first
> place, you know enough to stop it working (.suspend) and start it up
> again (.resume) for the hibernate case at least.

We're talking about _both_ the STR and STD.  The drivers that have problems
with the STR cannot be regarded as suspend/resume-safe IMO.

> I'm not assuming that you know enough to be able to put the driver into
> a low state and get it out again. This is definitely preferable, and at
> least possibly essential for suspend to ram, but for some unknown reason
> I'm quite hibernation focused, and for that, just the above is
> sufficient.

Please take the STR into consideration too.  After all we use the same
suspend/resume code for both STD and STR so it should work with both.  If it
doesn't work with one of them, we have a problem.

> > >> Also, in your argument you neglected a few cases:
> > >> - What if my device does not require power management?
> > > 
> > > Then you as a generic routine that does nothing but return success
> > > (potentially shared with other drivers that are in the same situation).
> > 
> > But if I just write an empty routine like that I open myself up to
> > criticism along the lines of "writing dummy routines just in order
> > to shut up kernel warnings". BTDT.
> 
> Well, it might not be completely empty. I think someone already pointed
> out that there's a minimal workset for the pci bus that pci drivers
> would want to invoke. But we wouldn't (rightly) accuse you of such
> things if we decided that the policy was "Every driver ought to have a
> resume routine, even if it's just a minimal I-just-work route".

I'm still thinking that would be wasteful.  I think there are more drivers that
work than there are drivers that don't work.

> > >> - What if I don't know whether my device requires power management?
> > > 
> > > The questions are straight forward: Is there hardware state that needs
> > > to be configured if you've just booted the computer and nothing else has
> > > touched it? If so, that needs to be done in a resume method. Do you need
> > > to clean up state prior to doing the things in the resume method, or
> > > otherwise do things to quiesce the driver? If so, they will need to be
> > > done in the suspend method. The result will be roughly similar to what
> > > you do for module load/unload, except maybe less complete in some cases.
> > 
> > I don't doubt your basic assessment. However it doesn't translate that
> > easily into a real implementation. In my case, I maintain a USB driver,
> > so I have to deal with USB specifics of suspend/resume which happen not
> > to be that well documented. My driver provides an isdn4linux device but
> > isdn4linux knows nothing about suspend/resume so I am on my own on how
> > to reconcile the two. The device itself, though in turn far from trivial,
> > is actually the least of my worries.
> 
> Mmm, so that's a case where we need to prod those who write
> documentation and bus support first. You're probably closer! :)

Actually, the lack of documentation is a major problem that we all should
try to fix in the first place.  Unfortunately the code has been recently
changing quite often, so that's difficult.

Greetings,
Rafael


  reply	other threads:[~2007-02-12 20:54 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-09 21:57 NAK new drivers without proper power management? Nigel Cunningham
2007-02-09 22:17 ` Arjan van de Ven
2007-02-09 22:26   ` Nigel Cunningham
2007-02-09 22:44     ` Rafael J. Wysocki
2007-02-09 22:44       ` Rafael J. Wysocki
2007-02-09 22:51       ` Nigel Cunningham
2007-02-09 22:51         ` Nigel Cunningham
2007-02-09 23:12         ` Rafael J. Wysocki
2007-02-09 23:12           ` Rafael J. Wysocki
2007-02-09 23:28           ` Nigel Cunningham
2007-02-09 23:28             ` Nigel Cunningham
2007-02-10  0:12             ` Rafael J. Wysocki
2007-02-10  0:12               ` Rafael J. Wysocki
2007-02-10  0:25     ` Jeff Garzik
2007-02-10  6:43       ` Willy Tarreau
2007-02-10 23:52         ` Tilman Schmidt
2007-02-10  7:15     ` Arjan van de Ven
2007-02-10 19:38   ` Pavel Machek
2007-02-10 22:20     ` Rafael J. Wysocki
2007-02-10 22:37       ` Nigel Cunningham
2007-02-10 23:45         ` Tilman Schmidt
2007-02-11  0:27           ` Rafael J. Wysocki
2007-02-11 22:41             ` Nigel Cunningham
2007-02-13 15:55               ` Mark Lord
2007-02-13 16:06                 ` Christoph Hellwig
2007-02-11 22:37           ` Nigel Cunningham
2007-02-12  0:10             ` Tilman Schmidt
2007-02-12  0:20               ` Rafael J. Wysocki
2007-02-12  4:08               ` Nigel Cunningham
2007-02-12 20:06                 ` Rafael J. Wysocki [this message]
2007-02-12 22:38                   ` Nigel Cunningham
2007-03-03 22:48               ` Suspend/resume semantics for ISDN drivers (was: NAK new drivers without proper power management?) Tilman Schmidt
2007-03-04 19:04                 ` Rafael J. Wysocki
2007-03-08 23:35                   ` Pavel Machek
2007-02-11  6:46         ` NAK new drivers without proper power management? Willy Tarreau
2007-02-11 13:04           ` Rafael J. Wysocki
2007-02-11 22:47           ` Nigel Cunningham
2007-02-11 22:57             ` Manu Abraham
2007-02-11 23:20               ` Nigel Cunningham
2007-02-11 23:25                 ` Manu Abraham
2007-02-11 23:29                   ` Pavel Machek
2007-02-11 23:33                   ` Nigel Cunningham
2007-02-12 16:52                     ` Pavel Machek
2007-02-12 20:31                       ` Rafael J. Wysocki
2007-02-12 20:58                         ` Pavel Machek
2007-02-12 21:01                           ` Rafael J. Wysocki
2007-02-12 21:24                             ` Nigel Cunningham
2007-02-12 21:43                               ` Rafael J. Wysocki
2007-02-13  9:42                         ` Tilman Schmidt
2007-02-13 19:24                           ` Rafael J. Wysocki
2007-02-14 23:45                             ` Stefan Richter
2007-02-12  9:45                   ` Arjan van de Ven
2007-02-12 12:59           ` Gerhard Mack
2007-02-12 20:20             ` Willy Tarreau
2007-02-13 15:23               ` Brad Campbell
2007-02-12 20:46             ` Rafael J. Wysocki
2007-02-12 13:51           ` Tino Keitel
2007-02-11 19:42       ` Pavel Machek
2007-02-11 21:02         ` Alan
2007-02-11 23:04           ` Rafael J. Wysocki
2007-02-12  0:28             ` Alan
2007-02-12  0:24               ` Rafael J. Wysocki
2007-02-11 23:10           ` Nigel Cunningham
2007-02-11 23:16             ` Rafael J. Wysocki
2007-02-11 23:22               ` Nigel Cunningham
2007-02-11 23:23                 ` Pavel Machek
2007-02-11 23:21             ` Pavel Machek
2007-02-11 23:29               ` Nigel Cunningham
2007-02-11 22:21         ` Tilman Schmidt
2007-02-12  8:49       ` Geert Uytterhoeven
2007-02-12 15:04         ` Pavel Machek
2007-02-12 15:57           ` Geert Uytterhoeven
2007-02-12 16:55             ` Pavel Machek
2007-02-12 20:38             ` Nigel Cunningham
2007-02-13 10:02             ` Tilman Schmidt
2007-02-10  3:42 ` Matthew Garrett
2007-02-10  4:42   ` Nigel Cunningham
     [not found] <fa.xSKPgY66Q+DPCZ1pszFFfdrJ0To@ifi.uio.no>
     [not found] ` <fa.FzHdYYYH5Ru57c8/yRxLylpH0Kk@ifi.uio.no>
     [not found]   ` <fa.DuG12yQo+RR4jIjJTnoOwtKM0Ao@ifi.uio.no>
     [not found]     ` <fa.Jy0FJQtASvVEpsy8Q96uoHtyEVA@ifi.uio.no>
2007-02-10  1:50       ` Robert Hancock
2007-02-10  1:59         ` Lee Revell
2007-02-10  2:09           ` Nigel Cunningham
2007-02-10  2:22             ` Lee Revell
2007-02-10  3:21               ` Kevin Fox
2007-02-10 20:40               ` Adrian Bunk
2007-02-10  4:35           ` Joseph Fannin
2007-02-13 21:08             ` Pavel Machek
2007-02-10 12:47           ` Stefan Richter
2007-02-10  2:05         ` Nigel Cunningham
2007-02-10  3:27           ` Dmitry Torokhov
2007-02-10  4:18             ` Nigel Cunningham
     [not found]   ` <fa.DhkemAgVI60diqZy0t9GzpwyLmk@ifi.uio.no>
     [not found]     ` <fa.E/NjHlgg0HqDg5CgZjnCHFi2AMM@ifi.uio.no>
     [not found]       ` <fa.kop49l/7yexJoUGrzk6vVeIP934@ifi.uio.no>
2007-02-10 23:20         ` Robert Hancock
2007-02-11  0:44           ` Rafael J. Wysocki
2007-02-11 17:01             ` Pavel Machek
2007-02-11 22:40             ` Nigel Cunningham
2007-02-11 23:29               ` Rafael J. Wysocki
2007-02-11 23:40                 ` Nigel Cunningham
     [not found]         ` <fa.EgQN5JpU6xrZSLyOY0kWjJ26hUM@ifi.uio.no>
2007-02-11 18:31           ` Robert Hancock
2007-02-11 21:52             ` Willy Tarreau
2007-02-11 22:26               ` Nigel Cunningham
2007-02-11 22:46                 ` Willy Tarreau
2007-02-11 23:18                   ` Nigel Cunningham
2007-02-11 23:38                     ` Willy Tarreau
2007-02-11 23:45                       ` Nigel Cunningham
2007-02-12  0:26                       ` Alan
2007-02-12  5:19                         ` Willy Tarreau
2007-02-12 20:20                           ` Rafael J. Wysocki
2007-02-12 22:36                           ` Nigel Cunningham
2007-02-11 23:23                   ` Alan
2007-02-11 23:38                   ` Rafael J. Wysocki
2007-02-11 23:41                 ` Rafael J. Wysocki
2007-02-11 23:47                   ` Nigel Cunningham
2007-02-11 23:50                     ` Rafael J. Wysocki
2007-02-11 23:55                       ` Nigel Cunningham
2007-02-12  0:09                         ` Rafael J. Wysocki
2007-02-12  0:15                           ` Nigel Cunningham
2007-02-12 12:19               ` Pavel Machek
     [not found]         ` <fa.O1YH4k5KtBGCNs5i2yB17bPvPGw@ifi.uio.no>
     [not found]           ` <fa.RfzClbTP/7B79AoEbQLNj3ABfIk@ifi.uio.no>
     [not found]             ` <fa.AaJ/ugmiUmPO8uC+y1rS9JLuuMc@ifi.uio.no>
2007-02-12  0:59               ` Robert Hancock

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=200702122106.25939.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nigel@nigel.suspend2.net \
    --cc=pavel@ucw.cz \
    --cc=tilman@imap.cc \
    /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.