Bug 195033 - [cam] [scsi] [patch] unclean SCSI attached HDD power-off on shut down
Summary: [cam] [scsi] [patch] unclean SCSI attached HDD power-off on shut down
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 10.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-scsi (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2014-11-15 11:05 UTC by Thomas Eberhardt
Modified: 2019-01-21 09:58 UTC (History)
2 users (show)

See Also:


Attachments
Patch to spin down scsi attached disks upon power down (4.30 KB, text/plain)
2014-11-15 11:05 UTC, Thomas Eberhardt
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Eberhardt 2014-11-15 11:05:03 UTC
Created attachment 149433 [details]
Patch to spin down scsi attached disks upon power down

Shutting down my system with ATA hard drives connected to several mps(4) LSI host
bus adapters causes the SMART Power-Off_Retract_Count attribute to increase
indicating an unclean power down. Attached is a patch to spin down the discs
upon shutdown based on the code in cam/ata/ata_da.c and r203420/r214279. I'm running
with this patch for over a year now and it works as intended on my system (Supermicro
X9SCM-F with 3 IBM M1015 HBA's flashed with LSI 9210-8i IT firmware and
20 WD SE SATA drives). The patch also fixes a few variable formatting issues in da(4).
Comment 1 Thomas Eberhardt 2015-12-06 12:06:12 UTC
I just found out about hw.mps.enable_ssu. When I set this
to 3 (MPS_SSU_ENABLE_SSD_ENABLE_HDD) my disks power down
cleanly (i.e. no Power-Off_Retract_Count increase).
You can close this bug if you want.
Comment 2 Ravi Pokala 2015-12-07 17:58:27 UTC
At the very least, hw.mps.enable_ssu should be documented in mps(4).

There's probably also an argument that the default value of MPS_SSU_ENABLE_SSD_DISABLE_HDD should be changed to MPS_SSU_ENABLE_SSD_ENABLE_HDD. With 512e and SMR, nowadays even HDDs appreciate a chance to quiesce up before they're powered down.
Comment 3 Ravi Pokala 2015-12-09 08:35:30 UTC
https://reviews.freebsd.org/D4456 is up for review. It both documents the enable_ssu knob, and changes the default value such that SSU is sent to both HDDs and SSDs.
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-12-11 21:51:55 UTC
A commit references this bug:

Author: rpokala
Date: Fri Dec 11 21:51:00 UTC 2015
New revision: 292123
URL: https://svnweb.freebsd.org/changeset/base/292123

Log:
  [PR 195033] Document mps.enable_ssu

  mps(4) sends StartStopUnit to SATA direct-access devices during shutdown.
  Document the tunables which control that behavior.

  PR:		195033
  Reviewed by:	scottl
  Approved by:	jhb
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D4456

Changes:
  head/share/man/man4/mps.4
Comment 5 Ravi Pokala 2015-12-11 21:53:07 UTC
(In reply to Thomas Eberhardt from comment #1)

After discussing w/ scottl@, we decided *not* to change the default value of enable_ssu; I just documented it.
Comment 6 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2019-01-21 09:58:44 UTC
There is a commit referencing this PR, but it's still not closed and has been inactive for some time. Closing the PR as fixed but feel free to re-open it if the issue hasn't been completely resolved.

Thanks