Re: [PATCH] PCI: Add pci shutdown ability

From: Benjamin Herrenschmidt (benh_at_kernel.crashing.org)
Date: 04/26/05

  • Next message: Andrew Morton: "Re: [PATCH][RFC][0/4] InfiniBand userspace verbs implementation"
    To: Adam Belay <abelay@novell.com>
    Date:	Tue, 26 Apr 2005 14:32:29 +1000
    
    

    > 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>
    -
    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/
    

  • Next message: Andrew Morton: "Re: [PATCH][RFC][0/4] InfiniBand userspace verbs implementation"

    Relevant Pages

    • USB client mass storage detection problem on WINCE5.0
      ... device be recognize as a USB mass storage device not connecting a USB ... usb mass storage driver and the and storage manager. ... State change: configured -> detached ... PID:a7f808d2 TID:47f0be6a 0x87eef748: UsbFnMdd! ...
      (microsoft.public.windowsce.platbuilder)
    • Re: USB client mass storage detection problem on WINCE5.0
      ... of storage is updated in PNPThread. ... As during USB mass storage connection there are several ... destroyed while being used by usb mass storage driver. ... State change: configured -> detached ...
      (microsoft.public.windowsce.platbuilder)
    • Re: SCSI device not created upon a CF card plug in
      ... GEOM should pick up the state change, but the bug may continue to exist ... CF card reader on boot will be picked up as /dev/da4 ... what to look for and that can be added to the FreeBSD umass driver. ...
      (freebsd-stable)
    • Re: [PATCH -mm] kexec jump -v9
      ... methods for each and every driver to handle that case, ... hibernation and suspend should be solved in separate patches. ... for a possible power state transition. ... @suspend place the device in a low power state. ...
      (Linux-Kernel)
    • Re: [RFC/PATCH 0/22] W1: sysfs, lifetime and other fixes
      ... >> and they must follow protocol, defined in family driver. ... > bus - it's all the same. ... it requires different locking, which may race - and I will fix it. ... Bus master driver is low-level part that lives in it's own driver, ...
      (Linux-Kernel)