public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Adam Belay <abelay@novell.com>
Cc: Dave Jones <davej@redhat.com>, Andrew Morton <akpm@osdl.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	alexn@dsv.su.se, Greg KH <greg@kroah.com>,
	gud@eth.net, Linux Kernel list <linux-kernel@vger.kernel.org>,
	linux-pci@atrey.karlin.mff.cuni.cz,
	Jeff Garzik <jgarzik@pobox.com>,
	cramerj@intel.com,
	Linux-USB <linux-usb-devel@lists.sourceforge.net>
Subject: Re: [PATCH] PCI: Add pci shutdown ability
Date: Tue, 26 Apr 2005 14:32:29 +1000	[thread overview]
Message-ID: <1114489949.7111.43.camel@gaston> (raw)
In-Reply-To: <20050425232330.GG27771@neo.rr.com>

> I've been considering for a while that, in addition to ->probe and ->remove, we
> have the following:
> 
> "struct device" -->
> ->attach - binds to the device and allocates data structures
> ->probe - detects and sets up the hardware
> ->start - begins transactions (like DMA)
> ->stop - stops transactions
> ->remove - prepares the hardware for no driver control
> ->detach - frees stuff and unbinds the device
> 
> ->start and ->stop would be optional, and only used where they apply.

>From my experience, this doesn't work. You actually want to have power
transitions and start/stop semantics to be "atomic" as far as drvier
state change is concerned. You can't for example stop all drivers, then
in a second pass, change the power state, since after you have stopped
drivers, you parent (bus) driver may not let you talk to your device
anymore for obvious reasons (and thus may prevent you from doing the
power state change).

We really want all this to be part of the normal power management
infrastructure. In this specific state, it's just basically a system
state, that has already been discussed at lenght and that we nicknamed
'freeze' since it's exactly what suspend-to-disk needs before
snapshoting the system image.

> ->probe and ->remove would be useful for resource rebalancing
> 
> Power management functions could (and usually should) manually call some of
> these.  Also this would be useful for error recovery and restarting devices.
> 
> Still, cpufreq seems like a difficult problem.  What's to prevent,
> hypothetically, an SMP system from stoping a device while the upper class
> layer tries to use it.

Proper locking in the driver should prevent that. if you have a problem
with "SMP", then you have a problem with preempt, and others ... then
your model is flawed. 
 
> If the class level locks control of the device, then
> DMA can't be stopped.  Also, attempting to stop device activity may fail
> if the driver decides it's not possible.

No locking should be at the class level. All locking should be local to
the device, unless the notion of device state is managed outside of the
driver.

I don't like this notion of "stop" separated from power states anyway, I
think it just doesn't work in practice.

Ben.

> Thanks,
> Adam
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
-- 
Benjamin Herrenschmidt <benh@kernel.crashing.org>


  reply	other threads:[~2005-04-26  4:33 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.44L0.0504251128070.5751-100000@iolanthe.rowland.org>
     [not found] ` <SVLXCHCON1syWVLEFN00000099e@SVLXCHCON1.enterprise.veritas.com>
     [not found]   ` <20050425182951.GA23209@kroah.com>
     [not found]     ` <20050425185113.GC23209@kroah.com>
2005-04-25 19:06       ` [PATCH] PCI: Add pci shutdown ability Greg KH
2005-04-25 19:23         ` Jeff Garzik
2005-04-25 20:07           ` Greg KH
2005-04-25 20:11           ` Adam Belay
2005-04-25 19:45         ` Alexander Nyberg
2005-04-25 20:12           ` Greg KH
2005-04-26  3:59             ` Benjamin Herrenschmidt
2005-04-25 20:14           ` Alan Stern
2005-04-25 20:52             ` Alexander Nyberg
2005-04-25 21:12               ` Alan Stern
2005-04-26 15:49                 ` Grant Grundler
2005-04-26 16:04                   ` Alan Stern
2005-04-26 16:37                     ` Grant Grundler
2005-04-26 17:14                       ` Alan Stern
2005-04-26 17:41                         ` Grant Grundler
2005-05-11  5:33                 ` Vivek Goyal
2005-05-11 14:38                   ` Alan Stern
2005-04-25 21:58             ` Andrew Morton
2005-04-25 22:13               ` Dave Jones
2005-04-25 23:23                 ` Adam Belay
2005-04-26  4:32                   ` Benjamin Herrenschmidt [this message]
2005-04-26  6:23                     ` Adam Belay
2005-04-26  7:14                       ` [linux-pm] " Nigel Cunningham
2005-04-26  9:16                       ` Pavel Machek
2005-04-26  9:41                   ` Pavel Machek
2005-04-26  3:52                 ` Benjamin Herrenschmidt
2005-04-26 15:14                   ` Alan Stern
2005-04-26  9:39                 ` Pavel Machek
2005-04-26 17:50                   ` Dave Jones
2005-04-26 20:23                     ` Pavel Machek
2005-04-26  3:45               ` Benjamin Herrenschmidt
2005-04-26 15:11               ` Alan Stern
2005-04-26 16:01                 ` Alexander Nyberg
2005-04-26 15:41             ` Grant Grundler
2005-04-26 16:07               ` Richard B. Johnson
2005-04-26 16:19                 ` Grant Grundler
2005-04-26 17:12                   ` Alan Stern
2005-04-26 17:19                     ` Lee Revell
2005-04-25 20:08         ` Adam Belay
2005-04-25 20:19           ` Greg KH
2005-04-25 20:24             ` Adam Belay
2005-04-25 20:42         ` Pavel Machek
2005-04-25 20:55           ` Adam Belay
2005-04-25 21:06             ` Pavel Machek
2005-04-26  4:30               ` Benjamin Herrenschmidt
2005-04-26 16:12                 ` Grant Grundler
2005-04-26 13:44               ` [linux-usb-devel] " David Brownell
2005-04-26 21:15                 ` Pavel Machek
2005-04-25 21:00           ` Greg KH
2005-04-25 21:13             ` Pavel Machek
2005-04-26  3:41             ` Benjamin Herrenschmidt
2005-04-26 10:11               ` Pavel Machek
2005-04-25 21:13           ` [linux-usb-devel] " David Brownell
2005-04-26  3:39           ` Benjamin Herrenschmidt
2005-04-26  6:33             ` Adam Belay
2005-04-26  6:44               ` Greg KH
2005-05-04  7:02 [PATCH] PCI: fix up word-aligned 16-bit PCI config access through sysfs Greg KH
2005-05-04  7:02 ` [PATCH] PCI: Add pci shutdown ability Greg KH

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=1114489949.7111.43.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=abelay@novell.com \
    --cc=akpm@osdl.org \
    --cc=alexn@dsv.su.se \
    --cc=cramerj@intel.com \
    --cc=davej@redhat.com \
    --cc=greg@kroah.com \
    --cc=gud@eth.net \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --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