Description Thomas Renninger 2007-08-07 07:48:53 UTC
Disk spins down twice, one is done through ACPI, one from libata core. This may need blacklisting of a lot machines, this bug is simply for dmidecode and acpidump collecting for these. Maybe we can still find similarities for working around in DSDT code...
Comment 1 Michael Sędkowski 2007-08-07 09:29:28 UTC
Created attachment 12297 [details] acpidump for hp nx6310
Comment 2 Michael Sędkowski 2007-08-07 09:30:22 UTC
Created attachment 12298 [details] dmidecode for hp nx6310
Comment 3 Sergey Dolgov 2007-08-14 01:12:14 UTC
Created attachment 12370 [details] acpidump for hp nx7300 My hp nx7300 exposes the same problem of double spindown on shutdown (first one due to libata and the second one issued by ACPI)
Comment 4 Sergey Dolgov 2007-08-14 01:13:21 UTC
Created attachment 12371 [details] dmidecode for hp nx7300
Comment 5 Rafael J. Wysocki 2007-09-23 11:23:23 UTC
(In reply to comment #0) > Disk spins down twice, one is done through ACPI, one from libata core. > > This may need blacklisting of a lot machines, this bug is simply for > dmidecode > and acpidump collecting for these. Maybe we can still find similarities for > working around in DSDT code... Well, I'm not sure about the blacklisting. Namely, if device_shutdown() in the power off sequence is replaced with device_suspend(), the problem doesn't appear. I'll post the details with an attachment.
Comment 6 Rafael J. Wysocki 2007-09-23 11:55:48 UTC
Created attachment 12910 [details] Patch that works around the problem The attached patch works around the problem by replacing the standard power off code with the code executed during hibernation, with the exception that S5 is used as the target state instead of S4. Interestingly, if the "if (device_suspend(PMSG_SUSPEND))" line is removed from the patch, which makes device_shutdown() to be executed in all cases, the "double disk spin off" problem reappears. This means that we do something in device_suspend() which is not done in device_shutdown() and which prevents the disk drive from spinning on before S5 is actually entered.
Comment 7 Vincent Fortier 2007-09-24 17:31:08 UTC
Created attachment 12919 [details] Similar problem (CK804 board) I think I may be having the same problem with shutdown/suspend. On shutdown the computer never completely stops. Here is a "screenshot" of the problem. Both suspend & shutdown used to work with 2.6.20. I haven't tried 2.6.21 but it does happend all the time on 2.6.22.
Comment 8 Vincent Fortier 2007-09-24 17:38:13 UTC
Created attachment 12920 [details] dmesg output Tried to get acpidump from http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/utils/pmtools-20070714-debug.tar.gz to work but got this message: [root@localhost acpidump]# ./acpidump --table DSDT ACPI tables were not found. If you know location of RSD PTR table (from dmesg, etc), supply it with either --addr or -a option
Comment 9 Tejun Heo 2007-09-24 18:16:44 UTC
Vincent, your problem is different one. Please file a separate bug reporting power isn't powered off properly.
Comment 10 Tejun Heo 2007-09-24 21:46:18 UTC
Rafael, during suspend, the controller is suspended which includes a call to pci_disable_device(). Maybe that's what's causing the difference. I don't think the workaround is a proper one, it's more of a happy accident. Note that there are machines which burn cpu cycles if the ATA controller is disabled when ACPI suspend is requested. I don't know whether that would apply to STD too but it's surely possible that some other machines will break if we suspend devices before powering off. I don't think we can avoid blacklisting here. Thanks.
Comment 11 Rafael J. Wysocki 2007-09-25 04:17:39 UTC
Well, first, I don't think that my patch above is the way to go. Still, it illustrates quite well that there's a difference between device_shutdown() and device_suspend() that leads to the platform spinning the disk for the second time in the latter case. IMHO, we should try to understand what _exactly_ the difference is. I'm not a (S)ATA expert, though. If you can prepare a debug patch for me, I'll run it and try to learn something from that. :-)
Comment 12 Tejun Heo 2007-09-25 16:34:20 UTC
> ------- Comment #11 from email@example.com 2007-09-25 04:17 ------- > Well, first, I don't think that my patch above is the way to go. Still, it > illustrates quite well that there's a difference between device_shutdown() > and > device_suspend() that leads to the platform spinning the disk for the second > time in the latter case. > > IMHO, we should try to understand what _exactly_ the difference is. I'm not > a > (S)ATA expert, though. If you can prepare a debug patch for me, I'll run it > and try to learn something from that. :-) I think drivers/ata/libata-core.c:ata_pci_device_do_suspend() is what's causing the difference. If you comment out pci_disable_device() and pci_set_power_state() calls in the function, I think you'll see double spindown with device_suspend() too. If you want resume to work properly, you'll need to change pcim_enable_device() call to pci_reenable_device(). Thanks.
Comment 13 Thomas Renninger 2008-01-09 02:26:55 UTC
I didn't follow up all the discussions about this one in detail. This bug should have been a collection of dmidecodes of machines which show up the double disk spin down (caused by BIOS triggered spin down) and therefore need blacklisting. AFAIK this is not needed anymore...
Comment 14 Tejun Heo 2008-01-09 03:19:27 UTC
How so? Is this problem resolved some other way?
Comment 15 Thomas Renninger 2008-01-09 04:32:04 UTC
I don't know. The last post is a quarter of a year ago... I am not that deep involved in this issue, I just wanted to create a reference of affected machines here. If you think this bug still makes sense, pls reopen, but someone else than me should get assigned to it...
Comment 16 Tejun Heo 2008-01-09 04:45:17 UTC
This one seems to have slipped through the crack. Do we still have reporters? Hello?
Comment 17 Rafael J. Wysocki 2008-01-09 10:33:05 UTC
Sure, I have an affected box. I didn't have the time to run the test requested in Comment #12, but I can do that if still relevant. Thanks.
Comment 18 Tejun Heo 2008-01-09 16:27:19 UTC
Yes, please. :-)
Comment 19 Rafael J. Wysocki 2008-01-09 16:30:33 UTC
I will tomorrow.
Comment 20 Rafael J. Wysocki 2008-01-10 14:02:09 UTC
I see (or rather hear) the double disk spindown with device_suspend() if the call to pci_set_power_state() is removed from ata_pci_device_do_suspend().
Comment 21 Tejun Heo 2008-01-10 19:27:28 UTC
Thanks for verifying, so that means the BIOS fails to issue spin down if the controller is powered down. Gee... BIOS should never do things like this. To which controller is the hard drive attached 1f.2? Is the controller fixed to ahci mode or can you switch between ahci and ata_piix? Can you please post the boot log and the result of 'lspci -nn'. Thanks.
Comment 22 Rafael J. Wysocki 2008-01-11 09:06:20 UTC
Created attachment 14414 [details] Boot log from HP nx6325 This is not Intel. It's a HP nx6325 with an ATI chipsed, it uses sata_sil.
Comment 23 Rafael J. Wysocki 2008-01-11 09:07:13 UTC
Created attachment 14415 [details] Output of lspci -nn from HP nx6325
Comment 24 Tejun Heo 2008-01-13 17:32:17 UTC
Rafael, can you please post the result of 'dmidecode' on the machine? We need to identify the machine to blacklist it. Also, does someone have a contact at HP? Are they doing this on all their laptops?
Comment 25 Rafael J. Wysocki 2008-01-14 14:51:29 UTC
Created attachment 14457 [details] Output of dmidecode from HP nx6325
Comment 26 Zhang Rui 2008-03-23 23:52:25 UTC
hmm, any update on this?
Comment 27 Rafael J. Wysocki 2008-03-24 04:29:09 UTC
Not that I know of.
Comment 28 Tejun Heo 2008-03-25 22:20:56 UTC
Created attachment 15441 [details] no-spindown-on-shutdown-quirk.patch This is nasty but I guess it's the only way to selectively disable spindown on shutdown. Can you please test this fixes the problem?
Comment 29 Tejun Heo 2008-05-13 20:45:41 UTC
Comment 30 Zhang Rui 2008-07-14 20:39:28 UTC
ping Rafael. :)
Comment 31 Rafael J. Wysocki 2008-07-15 03:24:26 UTC
Ah, sorry. I haven't been using shutdown at all on this box for the last few months. I'll try the patch later today.
Comment 32 Rafael J. Wysocki 2008-07-15 15:23:01 UTC
I tried to apply it on top of today's linux-next, but it looks like we've run out of flags in libata.h .
Comment 33 Rafael J. Wysocki 2008-08-28 04:21:27 UTC
Since the double spin-down propagated to the hibernation code path as well, it's become really annoying. I'm going to play with the patch from Comment #28 a bit shortly.
Comment 34 Rafael J. Wysocki 2008-08-28 07:05:34 UTC
Created attachment 17507 [details] Patch fixing "double spindown on shutdown" on nx6325 This is what I ended up with. While it does fix the "double spindown on shutdown" problem, it doesn't fix the (recently introduced) "double spindown on hibernation" problem.
Comment 35 Rafael J. Wysocki 2008-08-28 07:11:42 UTC
What is the function used for powering off SATA drives during suspend?
Comment 36 Rafael J. Wysocki 2008-08-28 14:31:14 UTC
Created attachment 17513 [details] Patch that fixes "double spindown" problem on shutdown and hibernation on nx6325 This patch fixes things for me, but I guess it needs some more work. Tejun?
Comment 37 Frans Pop 2008-08-29 04:30:35 UTC
Created attachment 17527 [details] dmidecode info for HP 2510p My HP Compaq 2510p laptop has the same issue with 2.6.27-rc5 for both shutdown and hibernation.
Comment 38 Maciej Rutecki 2008-08-29 07:21:00 UTC
dmidecode from hp/compaq nx6310 latest bios: http://unixy.pl/maciek/download/kernel/dmidecode.txt
Comment 39 Maciej Rutecki 2008-08-29 07:21:48 UTC
Created attachment 17530 [details] dmidecode from nx6310
Comment 40 Michael Sędkowski 2008-08-30 16:05:10 UTC
Created attachment 17545 [details] Another dmidecode from HP NX6310 laptop with the latest bios
Comment 41 Rafael J. Wysocki 2008-09-02 12:37:50 UTC
I need to know which SATA drivers are used on the affected systems. I guess it's sata_sil on the nx6310, but I'm not sure about the 2510p.
Comment 42 Rafael J. Wysocki 2008-09-02 14:17:42 UTC
Created attachment 17583 [details] Updated patch with quirks OK, I figured out this is AHCI on both nx6310 and 2510p. If that really is the case, please test this patch and report back, otherwise let me know which SATA driver is used on your system. If you test the patch, please run 'dmesg | grep "PCI slot:"' and post the output.
Comment 43 Maciej Rutecki 2008-09-02 14:42:40 UTC
nx6310 uses ATA_PIIX not SIL: maciek@gumis:~$ cat /boot/config-188.8.131.52 | grep SATA # CONFIG_BLK_DEV_IDE_SATA is not set # CONFIG_SATA_PMP is not set CONFIG_SATA_AHCI=y # CONFIG_SATA_SIL24 is not set # CONFIG_SATA_SVW is not set # CONFIG_SATA_MV is not set # CONFIG_SATA_NV is not set # CONFIG_SATA_QSTOR is not set # CONFIG_SATA_PROMISE is not set # CONFIG_SATA_SX4 is not set # CONFIG_SATA_SIL is not set # CONFIG_SATA_SIS is not set # CONFIG_SATA_ULI is not set # CONFIG_SATA_VIA is not set # CONFIG_SATA_VITESSE is not set # CONFIG_SATA_INIC162X is not set maciek@gumis:~$ cat /boot/config-184.108.40.206 | grep CONFIG_ATA # CONFIG_ATALK is not set # CONFIG_ATA_OVER_ETH is not set CONFIG_ATA=y # CONFIG_ATA_NONSTANDARD is not set CONFIG_ATA_ACPI=y CONFIG_ATA_SFF=y CONFIG_ATA_PIIX=y # CONFIG_ATA_GENERIC is not set # CONFIG_ATARI_PARTITION is not set maciek@gumis:~$ lspci | grep SATA 00:1f.2 SATA controller: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA AHCI Controller (rev 01) Still should I test this patch?
Comment 44 Rafael J. Wysocki 2008-09-03 08:31:08 UTC
Comment 45 Maciej Rutecki 2008-09-03 14:22:22 UTC
2.6.27-rc4, nx6310: maciek@gumis:~$ dmesg | grep "PCI slot:" ahci 0000:00:1f.2: PCI slot: 31 BTW "double spin down" still occur.
Comment 46 Maciej Rutecki 2008-09-03 14:23:30 UTC
Created attachment 17602 [details] dmesg from patched 2.6.27-rc4
Comment 47 Rafael J. Wysocki 2008-09-04 00:36:25 UTC
(In reply to comment #45) > 2.6.27-rc4, nx6310: > > maciek@gumis:~$ dmesg | grep "PCI slot:" > ahci 0000:00:1f.2: PCI slot: 31 > > BTW "double spin down" still occur. Strange, according to the dmesg output it should work.
Comment 48 Rafael J. Wysocki 2008-09-04 00:38:18 UTC
Created attachment 17613 [details] Debug patch to check the previous fix Please apply this patch on top of the previous one and see if you have the 10s wait and the "libata: Skipping disk spindown" message during shutdown.
Comment 49 Rafael J. Wysocki 2008-09-04 03:18:11 UTC
Note: With the patch from Comment #42 you will always hear the disk 'click' right before powering off the system, but it should not spin off earlier.
Comment 50 Maciej Rutecki 2008-09-04 04:56:36 UTC
A test patch from #48 (+#42). I hear that disk power off, after for moment power on and power off. I didn't see "libata: Skipping disk spindown" message during shutdown: http://unixy.pl/maciek/download/kernel/spin_down/20080904/img_0001.jpg Disk power on again on "ACPI: Preparing on enter system sleep state S5"
Comment 51 Rafael J. Wysocki 2008-09-04 05:24:56 UTC
Created attachment 17618 [details] Patch with quirks updated 2x I made a mistake in the patch from Comment #42, please try this one instead (please attach dmesg output).
Comment 52 Maciej Rutecki 2008-09-05 12:58:21 UTC
Created attachment 17636 [details] Kernel 2.6.27-rc4 with latest patch. "Double spin down" doesn't occur
Comment 53 Rafael J. Wysocki 2008-09-05 13:30:17 UTC
Created attachment 17638 [details] Cleaned-up quirk patch Thanks for testing! This patch is a cleaned-up version that I'd like to submit for inclusion. I have removed the 2510p entry from it, because of the missing PCI slot information, but we'll able to add this box to the list in future. Can you please test this one to make sure it still works on the nx6310 ?
Comment 54 Maciej Rutecki 2008-09-05 14:34:56 UTC
Created attachment 17639 [details] Last patch works fine, without any problems. Thanks for help
Comment 55 Frans Pop 2008-09-05 15:20:53 UTC
Created attachment 17640 [details] dmesg from HP Compaq 2510p Patch with id 17618 tested as requested, but does not work for me. Possibly because my laptop uses a different disk driver (ata_piix instead of sata_sil)?
Comment 56 Rafael J. Wysocki 2008-09-05 15:47:03 UTC
(In reply to comment #55) > Created an attachment (id=17640) [details] > dmesg from HP Compaq 2510p > > Patch with id 17618 tested as requested, but does not work for me. > Possibly because my laptop uses a different disk driver (ata_piix instead of > sata_sil)? Yes, it uses ata_piix, but I thought it would use AHCI. I'll prepare a patch for you to test in a while.
Comment 57 Rafael J. Wysocki 2008-09-05 16:08:23 UTC
Created attachment 17641 [details] Cleaned-up quirk patch with support for HP 2510p (partial) Frans, please test this patch and attach dmesg.
Comment 58 Frans Pop 2008-09-05 17:08:59 UTC
Created attachment 17642 [details] dmesg from HP Compaq 2510p with latest patch Seems to work correctly for me with patch 17641.
Comment 59 Rafael J. Wysocki 2008-09-06 03:56:37 UTC
Created attachment 17646 [details] Patch for nx6325, nx6310 and 2510p This is the patch I'm going to submit. It contains all of the necessary information for HP nx6325, HP nx6310 and HP 2510p. Maciej, Frans, please verify that it works for you ("quirky BIOS" should be present in dmesg output).
Comment 60 Maciej Rutecki 2008-09-06 05:27:07 UTC
Created attachment 17647 [details] demsg from 2.6.27-rc4 Works OK on nx6310
Comment 61 Maciej Rutecki 2008-09-07 09:09:50 UTC
I noticed one problem with patch id=17646 form comment #59 In 2.6.27-rc4(-rc5) a notice "click" (emergency head unload) from disk during hibernation (*not* during shutdown). It seems that power was cut off to fast. I remove this patch in 2.6.27-rc5 and hibernation works OK (on shutdown, except double spins down, too). differences between -rc4 and -rc5 (also I try this): -rc4: CONFIG_IDE=y -rc5: CONFIG_IDE is not set But this nothing change.
Comment 62 Rafael J. Wysocki 2008-09-07 14:44:36 UTC
Hm. On my box, without the patch from comment #59, I can hear two 'clicks' during hibernation (in the last phase), one caused by the kernel's disk spin-off and the second caused by the ACPI one. It seems to follow from your description that your box behaves differently during hibernation.
Comment 63 Rafael J. Wysocki 2008-09-07 14:49:09 UTC
Created attachment 17666 [details] Modified patch from comment #59 Please try this version of the patch and check if both hibernation and shutdown work as expected with it.
Comment 64 Frans Pop 2008-09-07 16:03:38 UTC
With this very latest patch I still get the double spinoff during hibernation, but not during power off on the 2510p.
Comment 65 Maciej Rutecki 2008-09-08 00:48:11 UTC
Test patch from comment #63. Hibernation and shutdown works OK. Also SMART shows, that disk is power off correctly. Thanks for help.
Comment 66 Rafael J. Wysocki 2008-09-09 14:45:20 UTC
Created attachment 17702 [details] Patch from comment #59 modified 2x This patch should work correctly for both of you. Please test it.
Comment 67 Maciej Rutecki 2008-09-10 04:53:02 UTC
Tested witch 2.6.27-rc5 on nx6310, hibernation and shutdown woks OK
Comment 68 Frans Pop 2008-09-10 06:22:46 UTC
Both shutdown and hibernation seem good now: only a single spin down with both. Tested with rc6 on my HP 2510p. One strange thing is that at the very end of hibernation I do hear a definite "pop" which I do not hear on shutdown. But the same "pop" is also there after the second spin down with unpatched 220.127.116.11 (and with rc5 with your previous patch). It does not result in an increase of the SMART power-off retract count though. I do hear the same "pop" if I force-shutdown the system by holding down the power button. So separate issue from your patch I think, but suggestions welcome.
Comment 69 Frans Pop 2008-09-10 06:39:12 UTC
P.S. I'm not at all sure that the "pop" is from the disk. I hear it on suspend to RAM too.
Comment 70 Frans Pop 2008-09-10 06:43:42 UTC
Ah, false alarm probably. I think the sound card is responsible: the "pop" seems to come from the speaker, but it's hard to localize with 100% certainty. Sorry for the noise.
Comment 71 Maciej Rutecki 2008-09-10 06:57:58 UTC
nx6310: shutdown XP: i hear silent "click" but it isn't emergency unload. The same on 2.6.27-rc(5..6) with/without(except double spin down) latest patch during shutdown and hibernation. And I think that patch works OK on my machine. When cut off power supply or push power button the "click" from disk is loud, and is different compared to normal shutdown/hibernation.
Comment 72 Pascal Vandeputte 2008-09-18 14:51:47 UTC
Created attachment 17868 [details] acpidump for HP nx7400 problem occurs only if the disk's power management settings have been altered with hdparm -B since cold boot (even if the original setting is restored with hdparm)
Comment 73 Pascal Vandeputte 2008-09-18 14:52:32 UTC
Created attachment 17869 [details] dmidecode for HP nx7400 problem occurs only if the disk's power management settings have been altered with hdparm -B since cold boot (even if the original setting is restored with hdparm)
Comment 74 Pascal Vandeputte 2008-09-18 14:57:00 UTC
Hi all, Sorry to be a little late to the party, but I have the same problem on my HP nx7400 laptop with a Seagate Momentus 5400.2 disk. It's a little more complicated though, as the spindown-spinup issue only happens if I disable power management on the disk in order to fix the dreaded "frequent head unload" problem (see http://ata.wiki.kernel.org/index.php/Known_issues#Drives_which_perform_frequent_head_unloads_under_Linux). In other words, if I do nothing then my disk will die too early because of the unload stuff, if I fix that with hdparm -B 2555 then it will die too early because of the "spindown twice" problem. What I've been doing up to now is just reboot the laptop and use the power button when I see GRUB coming up. Restoring the original power management setting with hdparm -B 128 before shutting down doesn't help. I've added acpidump and dmidecode attachments for the HP nx7400.
Comment 75 Frans Pop 2009-07-30 21:41:31 UTC
This BR is still open, but has been fixed ages ago by 2a6e58d2731dcc05dafa7f976d935e0f0627fcd7 (2.6.29-rc3).