Bug 13800 - Power is not disabled on USB ports at suspend to RAM
Power is not disabled on USB ports at suspend to RAM
Status: CLOSED INVALID
Product: Power Management
Classification: Unclassified
Component: Hibernation/Suspend
All Linux
: P1 normal
Assigned To: power-management_other
:
Depends on:
Blocks: 7216
  Show dependency treegraph
 
Reported: 2009-07-19 12:20 UTC by Christian Casteyde
Modified: 2011-07-30 04:55 UTC (History)
6 users (show)

See Also:
Kernel Version: 2.6.29, 2.6.30
Tree: Mainline
Regression: No


Attachments
dsdt file for this laptop (22.76 KB, application/octet-stream)
2009-07-19 12:21 UTC, Christian Casteyde
Details
dmesg output after boot for 2.6.31-rc3 (24.84 KB, text/plain)
2009-07-19 12:22 UTC, Christian Casteyde
Details
lspci -vxxx output (22.76 KB, text/plain)
2009-07-22 19:30 UTC, Christian Casteyde
Details
acpidump output (108.27 KB, text/plain)
2009-07-22 19:30 UTC, Christian Casteyde
Details
dmesg output with 2 suspend/resume (89.08 KB, text/plain)
2009-10-16 18:11 UTC, Christian Casteyde
Details
usbmon log while suspending with a USB hdd auto powered connected (184.05 KB, text/plain)
2009-11-01 12:39 UTC, Christian Casteyde
Details

Description Christian Casteyde 2009-07-19 12:20:14 UTC
I have noticed that, on suspend to RAM, self powered (through the USB port) external drives keeps running. I think the USB ports should be powered off to prevent USB device tiring the laptop battery while suspended on battery. For now I have to disconnect everything before suspending if I'm not on external power.

I do not remember if it worked once, so I'm not sure this is a regression or not, this problem occurs at least since 2.6.29 and maybe before.

The laptop used is an Acer Aspire 1511 LMi (64 bits mode). I do not know if this problem also occurs on other hardware (don't think so, otherwise it would certainly have been reported by anyone else). Can give any information on this hardware if necessary (dsdt, lspci, lsusb, dmesg...).
Comment 1 Christian Casteyde 2009-07-19 12:21:18 UTC
Created attachment 22398 [details]
dsdt file for this laptop
Comment 2 Christian Casteyde 2009-07-19 12:22:53 UTC
Created attachment 22399 [details]
dmesg output after boot for 2.6.31-rc3

This is for 2.6.31-rc3, since this was the latest kernel I checked.
Comment 3 ykzhao 2009-07-21 05:39:42 UTC
Will you please attach the output of acpidump, lspci -vxxx?
   Thanks.
Comment 4 Christian Casteyde 2009-07-22 19:30:06 UTC
Created attachment 22450 [details]
lspci -vxxx output
Comment 5 Christian Casteyde 2009-07-22 19:30:32 UTC
Created attachment 22451 [details]
acpidump output
Comment 6 Andrew Morton 2009-07-23 21:17:39 UTC
(Cc Alan)

Guys, could someone please have a think about whether this is an ACPI problem or a USB problem or something else so that we can get it routed appropriately?

Thanks.
Comment 7 Alan Stern 2009-07-23 21:26:31 UTC
Most PCs don't have any way to power off their USB ports, other than turning off the entire computer.  However, during system suspend the ports should be suspended (assuming you have enabled CONFIG_USB_SUSPEND).

To debug this further, attach a dmesg log showing a suspend/resume cycle under a kernel with CONFIG_USB_SUSPEND and CONFIG_USB_DEBUG turned on.
Comment 8 Zhang Rui 2009-10-15 08:12:17 UTC
close this bug as there is no response from the bug reporter.
please reopen it if
1. the problem still exists in 2.6.31
2. you can provide the info requested in comment #7. :)
Comment 9 Christian Casteyde 2009-10-16 18:10:39 UTC
Sorry, I've completly forgotten this one.

The problem still exists in 2.6.32-rc5, and I append the dmesg log with USB_SUSPEND (already activated) and DEBUG.
Comment 10 Christian Casteyde 2009-10-16 18:11:52 UTC
Created attachment 23434 [details]
dmesg output with 2 suspend/resume
Comment 11 Alan Stern 2009-10-16 19:02:41 UTC
The dmesg log looks quite normal, except for all those messages regarding the -121 errors on the USB flash drive.  Apart from that, I'd say nothing is wrong.  (But you might want to investigate what's going on with that flash drive.  You can use usbmon; see Documentation/usb/usbmon.txt.)

The computer isn't supposed to power down the USB ports.  If it did, the devices wouldn't be able to stay suspended -- suspended devices do need a small amount of power.

Instead, it's the device's job to make sure that it stops drawing large amounts of power when a suspend occurs.  Since the log shows that the suspends _did_ occur, if a bus-powered drive failed to spin down then it's the drive's own fault.  However it's possible that the drive expected to receive an explicit "spin-down" command.  Here's another place where usbmon can come in handy; it will show if that command got sent.
Comment 12 Christian Casteyde 2009-11-01 12:38:41 UTC
I tried to use USB mon as you say and got a nice file I hope will give some clues.

I did:
- start monitoring the whole bus (cat 0u);
- plug the USB hard disk device;
- suspended the devices:

echo devices > /sys/power/pm_test
echo mem > /sys/power/state

This freezes all processes and suspends all devices for 5 seconds.

- stop the cat process.

The resulting file is appended.
Comment 13 Christian Casteyde 2009-11-01 12:39:54 UTC
Created attachment 23617 [details]
usbmon log while suspending with a USB hdd auto powered connected
Comment 14 Alan Stern 2009-11-01 16:36:07 UTC
The usbmon log shows two things.  First, the USB flash device either isn't working right or else isn't able to read its media.  That's why you got all those -121 error messages in the dmesg log.

Second, the system does not try to spin down the Lacie disk.  This is controlled through a sysfs setting.  Look under /sys/class/scsi_disks/sdb (or something like that) for a file named "manage_start_stop", and write a "1" to that file.  This should cause the SCSI disk driver to spin the disk down during a suspend and spin it up during a resume.

If this does what you want, you can write a udev rule that will automatically set manage_start_stop to 1 for the Lacie drive.
Comment 15 Christian Casteyde 2009-11-02 18:45:38 UTC
OK, manage_start_stop does what I effectively wants the system to do.

I'm not fluent with udev rules, but now I know how to do it.

I wonder why the kernel does not use this option by default for removable devices on auto powered bus. But this is borderline with a distro bug. Don't know what to do with this one therefore, if you close it I won't reopen it.

Thanks
Comment 16 Alan Stern 2009-11-02 20:05:21 UTC
I don't know why manage_start_stop defaults to 0; you'll have to ask the SCSI developers.  Maybe some devices misbehave if you try to spin them up or down.

Also, this doesn't have anything to do with whether or not the device is "removable".  In fact, the word "removable" refers to the media, not to the drive itself.  A CDROM drive or card reader would be removable (because it's possible to eject the disc or the card) but a hard disk or flash drive is not.  Perhaps you meant "hot-unpluggable".

And whether the bus is auto-powered shouldn't matter.  For example, your Lacie drive doesn't run off bus power, does it?

If you want to pursue this matter further, go ahead and talk to the SCSI people.  However we have at least determined that this isn't a USB, ACPI, or Power Management issue.  Therefore it is appropriate to close the bug report.  I can't close it because I'm not the owner, but you can since you are the reporter.
Comment 17 Christian Casteyde 2009-11-02 22:16:28 UTC
I'm sorry, English is not my native tongue. I don't understand what "run off power" means ;-)

Anyway, the drive has no power plug, it relies on the USB bus power to run. That's why I want it to spin down when I suspend the computer, when the computer is not on AC power. Actually, I can power this device with an USB power cord and use it with firewire for data transfer, but it's quite usefull not to have power cord and AC adapter on it, because I just use it as a big USB memory stick.

Of course, the drive is not removable (don't know how it's call in English), but it's hot-(un)pluggable (I plug it in when I need to save/transfer data). Just as a memory stick indeed.

I'll close the bug. Still thanks a lot for all these explanations.
Regards

Note You need to log in before you can comment on or make changes to this bug.