Skip to content

Fix libata suspend/resume handling and code cleanup

Damien Le Moal linux-ide linux-scsi 8 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest23 patches 26 repliesIn review
  2. v723 patches 9 repliesSuperseded
  3. v623 patches 16 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v523 patches10 repliesSuperseded
v423 patches15 repliesSuperseded
v323 patches18 repliesSuperseded
v221 patches11 repliesSuperseded
v119 patches60 repliesSuperseded

Changes in v8 from the cover letter

* Fixed patch 2 commit message incorrect mention of WARN_ON() removal
* Changed patch 4 to use bool type for the new manage_xxx_start_top flags
* Changed patch 12 to keep the early return for when start stop management on resume is not necessary.
* Added review tags

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/23ata: libata-core: Fix ata_port_request_pm() lockingdrivers/ata/libata-core.c+9 -90 replies
2/23ata: libata-core: Fix port and device removaldrivers/ata/libata-core.c+20 -10 replies
3/23ata: libata-scsi: link ata port and scsi devicedrivers/ata/libata-scsi.c include/linux/libata.h+42 -50 replies
4/23scsi: sd: Differentiate system and runtime start/stop managementdrivers/ata/libata-scsi.c drivers/firewire/sbp2.c drivers/scsi/sd.c +1 more+84 -2314 replies
5/23ata: libata-scsi: Disable scsi device manage_system_start_stopdrivers/ata/libata-core.c drivers/ata/libata-eh.c drivers/ata/libata-scsi.c +2 more+148 -120 replies
6/23scsi: Do not attempt to rescan suspended devicesdrivers/scsi/scsi_scan.c include/scsi/scsi_host.h+18 -21 reply
7/23ata: libata-scsi: Fix delayed scsi_rescan_device() executiondrivers/ata/libata-core.c drivers/ata/libata-scsi.c+31 -180 replies
8/23ata: libata-core: Do not register PM operations for SAS portsdrivers/ata/libata-core.c drivers/ata/libata-transport.c drivers/ata/libata.h+11 -20 replies
9/23scsi: sd: Do not issue commands to suspended disks on shutdowndrivers/scsi/sd.c drivers/scsi/sd.h+14 -41 reply
10/23ata: libata-core: Fix compilation warning in ata_dev_config_ncq()drivers/ata/libata-core.c+1 -10 replies
11/23ata: libata-eh: Fix compilation warning in ata_eh_link_report()drivers/ata/libata-eh.c+1 -10 replies
12/23scsi: Remove scsi device no_start_on_resume flagdrivers/scsi/sd.c include/scsi/scsi_device.h+3 -71 reply
13/23ata: libata-scsi: Cleanup ata_scsi_start_stop_xlat()drivers/ata/libata-core.c drivers/ata/libata-scsi.c drivers/ata/libata.h+44 -660 replies
14/23ata: libata-core: Synchronize ata_port_detach() with hotplugdrivers/ata/libata-core.c+4 -40 replies
15/23ata: libata-core: Detach a port devices on shutdowndrivers/ata/libata-core.c+15 -10 replies
16/23ata: libata-core: Remove ata_port_suspend_async()drivers/ata/libata-core.c+17 -290 replies
17/23ata: libata-core: Remove ata_port_resume_async()drivers/ata/libata-core.c+8 -130 replies
18/23ata: libata-core: Do not poweroff runtime suspended portsdrivers/ata/libata-core.c+2 -10 replies
19/23ata: libata-core: Do not resume runtime suspended portsdrivers/ata/libata-core.c+2 -40 replies
20/23ata: libata-sata: Improve ata_sas_slave_configure()drivers/ata/libata-sata.c+2 -20 replies
21/23ata: libata-eh: Improve reset error messagesdrivers/ata/libata-eh.c drivers/ata/libata-sata.c+2 -10 replies
22/23ata: libata-eh: Reduce "disable device" message verbositydrivers/ata/libata-eh.c+19 -130 replies
23/23ata: libata: Cleanup inline DMA helper functionsinclude/linux/libata.h+8 -100 replies

Reviews trailers per patch

All 23 patches have a Reviewed-by or Acked-by.

PatchHannes ReineckeChia-Lin Kao (AceLan)Niklas CasselGeert UytterhoevenMartin K. PetersenBart Van AsscheJohn Garry
1/23R-b T-b R-b T-b R-b R-b
2/23R-b T-b R-b T-b R-b
3/23R-b R-b T-b R-b R-b
4/23R-b T-b R-b R-b
5/23R-b T-b R-b
6/23R-b R-b T-b R-b R-b R-b
7/23R-b R-b T-b R-b
8/23R-b T-b T-b R-b R-b
9/23R-b R-b
10/23R-b T-b R-b
11/23R-b T-b R-b
12/23R-b T-b T-b R-b R-b
13/23R-b T-b T-b R-b
14/23R-b T-b T-b R-b
15/23R-b T-b T-b R-b
16/23R-b T-b T-b R-b
17/23R-b T-b T-b R-b
18/23R-b T-b T-b R-b
19/23R-b T-b T-b R-b
20/23R-b T-b T-b R-b R-b
21/23R-b T-b T-b R-b
22/23R-b T-b T-b R-b
23/23R-b T-b T-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 7 reviewers.

Read the v8 thread

Cover letter [PATCH v8 00/23] Fix libata suspend/resume handling and code cleanup

The first 9 patches of this series fix several issues with suspend/resume power management operations in scsi and libata. The most significant changes introduced are in patch 4 and 5, where the manage_start_stop flag of scsi devices is split into the manage_system_start_stop and manage_runtime_start_stop flags to allow keeping scsi runtime power operations for spining up/down ATA devices but have libata do its own system suspend/resume device power state management using EH.

The remaining patches are code cleanup that do not introduce any significant functional change.

This series was tested on qemu and on various PCs and servers. I am CC-ing people who recently reported issues with suspend/resume. Additional testing would be much appreciated.

Changes from v7:
* Fixed patch 2 commit message incorrect mention of WARN_ON() removal
* Changed patch 4 to use bool type for the new manage_xxx_start_top flags
* Changed patch 12 to keep the early return for when start stop management on resume is not necessary.
* Added review tags

Changes from v6:
* Changed patch 9 to use a bool for the new suspended flag.

Changes from v5:
* Typo and style corrections in patch 4 commit message
* Changed patch 9 to use a new flag to track a disk suspended state instead of using the scsi device state
* Added review tags

Changes from v4:
* Remove ata_scsi_dev_alloc() function in patch 3, coding it directly in ata_scsi_slave_alloc()
* Correct typo in patch 19 commit message
* Added Tested and review tags

Changes from v3:
* Corrected patch 1 (typo in commit message and WARN_ON() removal)
* Changed path 3 as suggested by Niklas (moved definition of ->slave_alloc)
* Rebased on rc2
* Added review tags

Changes from v2:
* Added patch 4 as simply disabling manage_start_stop from libata was breaking individual disk runtime suspend/autosuspend. Patch 5 was reworked accordingly to the changes in patch 4.
* Fixed patch 3: applying the link creation was missing and the link creation itself was also incorrect, preventing sd probe to execute correctly. Thanks to Geert for testing and reporting this issue.
* Split the "Fix delayed scsi_rescan_device() execution" patch into patch 6 (scsi part) and patch 7 (ata part).
* Modified patch 9 to not call sd_shutdown() from sd_remove() for devices that are not running.
* Added Chia-Lin Tested tag to unchanged patches

Changes from v1:
* Added patch 8 and 9 to fix compilation warnings with W=1
* Addressed John comment in patch 19
* Fixed patch 20 commit message (Sergei)
* Added Hannes Review tag

Damien Le Moal (23):
ata: libata-core: Fix ata_port_request_pm() locking
ata: libata-core: Fix port and device removal
ata: libata-scsi: link ata port and scsi device
scsi: sd: Differentiate system and runtime start/stop management
ata: libata-scsi: Disable scsi device manage_system_start_stop
scsi: Do not attempt to rescan suspended devices
ata: libata-scsi: Fix delayed scsi_rescan_device() execution
ata: libata-core: Do not register PM operations for SAS ports
scsi: sd: Do not issue commands to suspended disks on shutdown
ata: libata-core: Fix compilation warning in ata_dev_config_ncq()
ata: libata-eh: Fix compilation warning in ata_eh_link_report()
scsi: Remove scsi device no_start_on_resume flag
ata: libata-scsi: Cleanup ata_scsi_start_stop_xlat()
ata: libata-core: Synchronize ata_port_detach() with hotplug
ata: libata-core: Detach a port devices on shutdown
ata: libata-core: Remove ata_port_suspend_async()
ata: libata-core: Remove ata_port_resume_async()
ata: libata-core: Do not poweroff runtime suspended ports
ata: libata-core: Do not resume runtime suspended ports
ata: libata-sata: Improve ata_sas_slave_configure()
ata: libata-eh: Improve reset error messages
ata: libata-eh: Reduce "disable device" message verbosity
ata: libata: Cleanup inline DMA helper functions

 drivers/ata/libata-core.c      | 242 +++++++++++++++++++++++++--------
 drivers/ata/libata-eh.c        |  76 +++++++++--
 drivers/ata/libata-sata.c      |   5 +-
 drivers/ata/libata-scsi.c      | 142 ++++++++++---------
 drivers/ata/libata-transport.c |   9 +-
 drivers/ata/libata.h           |   6 +
 drivers/firewire/sbp2.c        |   9 +-
 drivers/scsi/scsi_scan.c       |  18 ++-
 drivers/scsi/sd.c              | 102 +++++++++++---
 drivers/scsi/sd.h              |   1 +
 include/linux/libata.h         |  26 ++--
 include/scsi/scsi_device.h     |   4 +-
 include/scsi/scsi_host.h       |   2 +-
 13 files changed, 457 insertions(+), 185 deletions(-)
Signature · 47 lines
2.41.0


*** BLURB HERE ***

Damien Le Moal (23):
  ata: libata-core: Fix ata_port_request_pm() locking
  ata: libata-core: Fix port and device removal
  ata: libata-scsi: link ata port and scsi device
  scsi: sd: Differentiate system and runtime start/stop management
  ata: libata-scsi: Disable scsi device manage_system_start_stop
  scsi: Do not attempt to rescan suspended devices
  ata: libata-scsi: Fix delayed scsi_rescan_device() execution
  ata: libata-core: Do not register PM operations for SAS ports
  scsi: sd: Do not issue commands to suspended disks on shutdown
  ata: libata-core: Fix compilation warning in ata_dev_config_ncq()
  ata: libata-eh: Fix compilation warning in ata_eh_link_report()
  scsi: Remove scsi device no_start_on_resume flag
  ata: libata-scsi: Cleanup ata_scsi_start_stop_xlat()
  ata: libata-core: Synchronize ata_port_detach() with hotplug
  ata: libata-core: Detach a port devices on shutdown
  ata: libata-core: Remove ata_port_suspend_async()
  ata: libata-core: Remove ata_port_resume_async()
  ata: libata-core: Do not poweroff runtime suspended ports
  ata: libata-core: Do not resume runtime suspended ports
  ata: libata-sata: Improve ata_sas_slave_configure()
  ata: libata-eh: Improve reset error messages
  ata: libata-eh: Reduce "disable device" message verbosity
  ata: libata: Cleanup inline DMA helper functions

 drivers/ata/libata-core.c      | 242 +++++++++++++++++++++++++--------
 drivers/ata/libata-eh.c        |  76 +++++++++--
 drivers/ata/libata-sata.c      |   5 +-
 drivers/ata/libata-scsi.c      | 142 ++++++++++---------
 drivers/ata/libata-transport.c |   9 +-
 drivers/ata/libata.h           |   6 +
 drivers/firewire/sbp2.c        |   9 +-
 drivers/scsi/scsi_scan.c       |  18 ++-
 drivers/scsi/sd.c              | 108 +++++++++++----
 drivers/scsi/sd.h              |   1 +
 include/linux/libata.h         |  26 ++--
 include/scsi/scsi_device.h     |   6 +-
 include/scsi/scsi_host.h       |   2 +-
 13 files changed, 463 insertions(+), 187 deletions(-)

-- 
2.41.0