Patch: linux-2.5.42/kernel/sys.c - warm reboot should not suspend devices
Quoted 10 lines · Russell King
Quoted 8 lines · Adam J. Richter
I have no objection to replacing or supplementing the reboot
notifier chain with a method in structdevice_driver, but let's not overload these methods with ambiguous semantics. I do not want to call thirty functions that primarily return memory to various memory allocators, mark a bunch of inodes as invalid, and otherwise arrange things so that the kernel can smoothly continue to run user level programs when, in fact, we just want to pull the reset line on the computer.
Quoted 5 lines
And what about setups where you can't pull the reset line from software. I have several machines here like that. And one of them needs software to talk to the cards to put them back into a sane state before rebooting.
"rebooting" in this particular case is "turn MMU off, jump to location 0"
As I send in my response Eric Biederman,
| If you have a platform where, for example, somehow PCI devices | are able to continue jabbering away after the computer has been reset, | then that could probably be done more consistently for most drivers by | having machine_restart on that platform walk the PCI bus and shut down | everything (drivers that need to do something really special would | still use the reboot notifier). | | I could even see calling device_shutdown from machine_restart | on that platform only, [...]
Quoted 3 lines
And I never said anything about needing to allocate memory to do this. I agree with you that suspending devices on reboot _is_ silly. However, that's not what I was proposing.
Then you've started a new thread of discussion, becausedevice_shutdown is defined in drivers/base/power.c as:
void device_shutdown(void)
{
device_suspend(4, SUSPEND_POWER_DOWN);
} Perhaps device_suspend ought to be renamed device_power_down.
However, I'm not trying to quash what you want to discuss.
I'd be interested in hearing about clarifications and perhaps extensions of the struct device_driver methods, which I think is what you're getting at, perhaps here or on linux-hotplug. It's just that, for this thread, I'm trying to focus on my patch that eliminates the software suspend on reboot (pros and cons, alternatives to it, etc.).
Adam J. Richter __ ______________ 575 Oroville Road [email protected] \ / Milpitas, California 95035 +1 408 309-6081 | g g d r a s i l United States of America
"Free Software For The Rest Of Us."
Quoted 43 lines · Adam J. Richter
Quoted 10 lines · Russell King
Quoted 8 lines · Adam J. Richter
I have no objection to replacing or supplementing the reboot
notifier chain with a method in structdevice_driver, but let's not overload these methods with ambiguous semantics. I do not want to call thirty functions that primarily return memory to various memory allocators, mark a bunch of inodes as invalid, and otherwise arrange things so that the kernel can smoothly continue to run user level programs when, in fact, we just want to pull the reset line on the computer.Quoted 5 lines
And what about setups where you can't pull the reset line from software. I have several machines here like that. And one of them needs software to talk to the cards to put them back into a sane state before rebooting.
"rebooting" in this particular case is "turn MMU off, jump to location 0"
As I send in my response Eric Biederman,
| If you have a platform where, for example, somehow PCI devices | are able to continue jabbering away after the computer has been reset, | then that could probably be done more consistently for most drivers by | having machine_restart on that platform walk the PCI bus and shut down | everything (drivers that need to do something really special would | still use the reboot notifier). | | I could even see calling device_shutdown from machine_restart | on that platform only, [...]Quoted 3 lines
And I never said anything about needing to allocate memory to do this. I agree with you that suspending devices on reboot _is_ silly. However, that's not what I was proposing.
Then you've started a new thread of discussion, because
device_shutdownis defined indrivers/base/power.cas:void
device_shutdown(void){ device_suspend(4, SUSPEND_POWER_DOWN); }
Quoted 8 lines
Perhaps
device_suspendought to be renameddevice_power_down.However, I'm not trying to quash what you want to discuss.
I'd be interested in hearing about clarifications and perhaps extensions of the structdevice_drivermethods, which I think is what you're getting at, perhaps here or on linux-hotplug. It's just that, for this thread, I'm trying to focus on my patch that eliminates the software suspend on reboot (pros and cons, alternatives to it, etc.).
The 2.5.41 variant is below. The bug is reusing the old enumeration value as was previously mentioned.
/**
* device_shutdown - queisce all the devices before reboot/shutdown *
* Do depth first iteration over device tree, calling ->remove() for each
* device. This should ensure the devices are put into a sane state before
* we reboot the system.
*
* device_shutdown - call device_suspend with status set to shutdown, to
* cause all devices to remove themselves cleanly
*/
void device_shutdown(void)
{
struct list_head * node, * next;
struct device * prev = NULL;
printk(KERN_EMERG "Shutting down devices\n");
spin_lock(&device_lock);
list_for_each_safe(node,next,&global_device_list) {
struct device * dev = get_device_locked(to_dev(node));
if (dev) {
spin_unlock(&device_lock);
if (dev->driver && dev->driver->remove)
dev->driver->remove(dev);
if (prev)
put_device(prev);
prev = dev;
spin_lock(&device_lock);
}
}
spin_unlock(&device_lock);
if (prev)
put_device(prev);
}Eric
k
Here is where I realize that I've forgotten to CC: the list on all the traffic that I keep sending between Eric and Adam. D'oh.
Quoted 11 lines · Eric W. Biederman
Quoted 7 lines
However, I'm not trying to quash what you want to discuss.
I'd be interested in hearing about clarifications and perhaps extensions of the structdevice_drivermethods, which I think is what you're getting at, perhaps here or on linux-hotplug. It's just that, for this thread, I'm trying to focus on my patch that eliminates the software suspend on reboot (pros and cons, alternatives to it, etc.).The 2.5.41 variant is below. The bug is reusing the old enumeration value as was previously mentioned.
I tried to submit a fix to this, but the only response I've gotten back is that it failed to apply. My original patch excluded the bit from device.h that added a new state to the enumeration, and when it got into the tree, it got into the tree using the current states that were available. My bad.
Eric has already indicated earlier, that Adam's issue is, however, not with the changes to drivers/base/power.c but to the changes to the IDE driver.
- Eric
Quoted 23 lines · Eric Blade
Here is where I realize that I've forgotten to CC: the list on all the traffic that I keep sending between Eric and Adam. D'oh.
Quoted 11 lines · Eric W. Biederman
Quoted 7 lines
However, I'm not trying to quash what you want to discuss.
I'd be interested in hearing about clarifications and perhaps extensions of the structdevice_drivermethods, which I think is what you're getting at, perhaps here or on linux-hotplug. It's just that, for this thread, I'm trying to focus on my patch that eliminates the software suspend on reboot (pros and cons, alternatives to it, etc.).The 2.5.41 variant is below. The bug is reusing the old enumeration value as was previously mentioned.
I tried to submit a fix to this, but the only response I've gotten back is that it failed to apply. My original patch excluded the bit from
device.hthat added a new state to the enumeration, and when it got into the tree, it got into the tree using the current states that were available. My bad.
Quoted 3 lines
Eric has already indicated earlier, that Adam's issue is, however, not with the changes to
drivers/base/power.cbut to the changes to the IDE driver.
Correct. But when people try to use power management they will see the bug. SUSPEND_POWER_DOWN (a request for the driver to remove power from the device) is a very different state from SUSPEND_DETACH (a request to disassociate the driver from the device). I am not fully convinced the two cases should be merged.
SUSPEND_POWER_DOWN as defined should actually cause the behavior Adam was seeing. Which made it doubly interesting.
Will you submit a patch detangling this mess? I believe Adams only problem was that it did not obviously fix his problem.
Eric
Quoted 7 lines · Eric W. Biederman
SUSPEND_POWER_DOWNas defined should actually cause the behavior Adam was seeing. Which made it doubly interesting.Will you submit a patch detangling this mess? I believe Adams only problem was that it did not obviously fix his problem.
Submitted earlier last night.
subj: Patch: linux-2.5.42/drivers/base/power.c - add state forSHUT_DOWN
Cheers,
- Eric