Re: [PATCH] scsi: sd: stop SSD (non-rotational) disks before reboot
From: Damien Le Moal <hidden>
Date: 2020-06-30 01:05:18
Also in:
linux-scsi, lkml
On 2020/06/29 3:23, Simon Arlott wrote:
On 19/06/2020 00:31, Damien Le Moal wrote:quoted
On 2020/06/18 21:26, Simon Arlott wrote:quoted
I haven't verified it, but the BIOS leaves the power off for several seconds which should be long enough for the HDDs to spin down. I'm less concerned about those suddenly losing power but it would be nice to have a stop command sent to them too.OK. So maybe the patch should be as simple as changing SYSTEM_RESTART state to SYSTEM_POWER_OFF if reboot=p is set, no ? Since that is consistent with the fact that reboot=p will cause power to go off, exactly the same as a regular shutdown, it seems cleaner and safer to use SYSTEM_POWER_OFF for the entire system, not just scsi disks.That could be a bit misleading because the power isn't going to stay off. Some of the network drivers have specific WOL behaviour changes for a power off.
The point is that the power goes off, same as for a SYSTEM_POWER_OFF shutdown. It do not think it matters how long it will be off before your BIOS restarts the laptop power. And actually enabling the NICs WOL function would I think actually be a very good thing: if the PSU power cycling fails, the machine can still be remotely woken-up as configured by the user.
Power cycling the PSU is not something that every BIOS will do, so it's not that simple. It could be a module parameter but I'd be concerned that some other code will assuming the system should be powered off and all of my reboots will become power off events.
Or define a SYSTEM_RESTART_P that essentially does what SYSTEM_POWER_OFF does + the addition of telling the BIOS to restart the PSU, if the machines supports it. What happens if one does a reboot=p on a machine that does not support it ? Does this become a shutdown, or does it become a normal reset ? -- Damien Le Moal Western Digital Research