On Monday 02 August 2004 17:50, Benjamin Herrenschmidt wrote: > you ask a driver to quiesce, it's the driver's policy to decide what is > the best suitable HW state based on what system state we are going into > (or what is asked by userland, that is quiesce, shutdown, or whatever > semantics we'll provide once we clanup the sysfs side of things). So long as it's policy, I want drivers _needing_ to handle it to be the very last choice on the list ... not the very first one! I think the "cleanup" needs to handle many different kinds of suspend things ... policy objects, bus-specific states, driver-specific states, system policy rules, and so on. Step one, stop using "u32" for all of them, instead of some kind of typed pointer! > > How does your answer change when you go down the path I was > > describing: the drivers are passed a device-specific state? Which for > > PCI means no API changes; the drivers already expect to see > > the PCI state number. > > Change ? How so ? I always said the same thing... and no, that is NOT a > PCI state number, Since 2.4, the PCI calls have said it's a PCI state number; that'd be the change, making it NOT be a PCI state number. > > > > the PM core self-deadlocks since > > > > suspend/resume outcalls are done while holding the semaphore > > > > that device_pm_remove() needs, ugh. > > > > > > That's an old problem,.... > > > > Patrick once posted a patch that morphed the semaphore into a > > spinlock (in at least some cases), which worked for me, but that > > never got merged. > > Patrick ? Do you still have that around ? I dug it up; attached, that machine hasn't quite entirely died yet! > Low level drivers, at this point, don't really know if they are in use > in some cases, do they ? There are levels of usage they can see, others they can't. Higher level drivers can't tell what lower level ones know either ... :) > But anyway, to get userland originated suspend > to possibly do anything useful, we first need to fix sysfs so that it > does partial tree suspend and not individual deviecs suspend only. Yes, something that turns a tree into a list (that nobody else can morph!) and then walks the list ... recursion ok only for prototypes. > There's also a semantic breakage between who updates the power state in > struct device, system suspend relies on the driver doing so afaik, while > sysfs originated calls to the driver suspend will do it in sysfs (which > I think is the wrong thing to do). That is, drivers should always do this? That makes sense to me; how else are they going to be able to report actual suspend state (which may not be as requested)? And hmm, sysfs PCI state would be better read (and written!) as "PCI_D3" rather than "ACPI_D2". > > Actually no; I was describing what would be an ACPI G0/S0 state > > where most devices/drivers are powered down, not the G1/S1 state > > described as "suspend". CPU would be running, for example. It's > > a power management policy, not a suspend policy ... it kicks in > > during normal operation. > > And who wakes up the devices in this ACPI state ? (just curious) Whoever suspended the device should be able to resume it; they're the ones with the local knowledge, after all! Unless you're maybe thinking that global rules should apply too... :) - Dave