No description
Find a file
Bart Van Assche 9131bff6a9 scsi: core: pm: Only runtime resume if necessary
The following query shows which drivers define callbacks that are called by
the power management support code in the SCSI core (scsi_pm.c):

$ git grep -nHEwA16 "$(echo $(git grep -h 'scsi_register_driver(&' |
      sed 's/.*&//;s/\..*//') | sed 's/ /|/g')" |
    grep '\.pm[[:blank:]]*=[[:blank:]]'
drivers/scsi/sd.c-620-			.pm = &sd_pm_ops,
drivers/scsi/sr.c-100-			.pm = &sr_pm_ops,
drivers/scsi/ufs/ufshcd.c-9765-		.pm = &ufshcd_wl_pm_ops,

Since unconditionally runtime resuming a device during system resume is not
necessary, remove that code. Modify the SCSI disk (sd) driver such that it
follows the same approach as the UFS driver, namely to skip system suspend
and resume for devices that are runtime suspended. The CD-ROM code does not
need to be updated since its PM callbacks do not affect the device power
state.

This patch has been tested as follows:

[ shell 1 ]

cd /sys/kernel/debug/tracing
grep -E 'blk_(pre|post)_runtime|runtime_(suspend|resume)|autosuspend_delay|pm_runtime_(get|put)' available_filter_functions |
  while read a b; do echo "$a"; done |
  grep -v __pm_runtime_resume >set_ftrace_filter
echo function > current_tracer
echo 1 > tracing_on
cat trace_pipe

[ shell 2 ]

cd /sys/block/sr0
 # Increase the event poll interval to make it easier to derive from the
 # tracing output whether runtime power actions are the result of sg_inq.
echo 30000 > events_poll_msecs
cd device/power
 # Enable runtime power management.
echo auto > control
echo 1000 > autosuspend_delay_ms
sleep 1
 # Verify in shell 1 that sr0 has been runtime suspended
sg_inq /dev/sr0
eject /dev/sr0
sg_inq /dev/sr0
 # Disable runtime power management.
echo on > control

cd /sys/block/sda/device/power
echo auto > control
echo 1000 > autosuspend_delay_ms
sleep 1
 # Verify in shell 1 that sr0 has been runtime suspended
sg_inq /dev/sda

Link: https://lore.kernel.org/r/20211006215453.3318929-4-bvanassche@acm.org
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Martin Kepplinger <martin.kepplinger@puri.sm>
Tested-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-10-16 21:08:39 -04:00
arch Updates for the SMP and CPU hotplug: 2021-09-12 12:42:51 -07:00
block scsi: bsg: Fix device unregistration 2021-09-14 00:22:15 -04:00
certs certs: Add support for using elliptic curve keys for signing modules 2021-08-23 19:55:42 +03:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2021-08-30 12:57:10 -07:00
Documentation scsi: Documentation: Fix typo in sysfs-driver-ufs 2021-10-12 22:55:29 -04:00
drivers scsi: core: pm: Only runtime resume if necessary 2021-10-16 21:08:39 -04:00
fs Merge branch 'misc.namei' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2021-09-12 10:43:51 -07:00
include scsi: libsas: Export sas_phy_enable() 2021-10-12 22:46:06 -04:00
init More tracing updates for 5.15: 2021-09-09 13:11:15 -07:00
ipc ARM development updates for 5.15: 2021-09-09 13:25:49 -07:00
kernel - Make sure the idle timer expires in hardirq context, on PREEMPT_RT 2021-09-12 11:37:41 -07:00
lib Minor fixes to the processing of the bootconfig tree. 2021-09-11 10:16:30 -07:00
LICENSES LICENSES/dual/CC-BY-4.0: Git rid of "smart quotes" 2021-07-15 06:31:24 -06:00
mm ARM development updates for 5.15: 2021-09-09 13:25:49 -07:00
net virtio,vdpa,vhost: features, fixes 2021-09-11 14:48:42 -07:00
samples kgdb patches for 5.15 2021-09-07 12:08:04 -07:00
scripts RISC-V Patches for the 5.15 Merge Window, Part 2 2021-09-11 14:29:42 -07:00
security Kbuild updates for v5.15 2021-09-03 15:33:47 -07:00
sound sound fixes for 5.15-rc1 2021-09-09 16:05:10 -07:00
tools perf tools changes for v5.15: 2nd batch 2021-09-12 16:18:15 -07:00
usr .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
virt KVM: Drop unused kvm_dirty_gfn_invalid() 2021-09-06 08:23:46 -04:00
.clang-format clang-format: Update with the latest for_each macro list 2021-05-12 23:32:39 +02:00
.cocciconfig
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl 2019-05-16 10:53:40 -07:00
.gitattributes .gitattributes: use 'dts' diff driver for dts files 2019-12-04 19:44:11 -08:00
.gitignore .gitignore: ignore only top-level modules.builtin 2021-05-02 00:43:35 +09:00
.mailmap mailmap: update email address of Matthias Fuchs and Thomas Körper 2021-08-19 09:39:44 +02:00
COPYING COPYING: state that all contributions really are covered by this file 2020-02-10 13:32:20 -08:00
CREDITS MAINTAINERS: move Murali Karicheri to credits 2021-04-29 15:47:30 -07:00
Kbuild kbuild: rename hostprogs-y/always to hostprogs/always-y 2020-02-04 01:53:07 +09:00
Kconfig kbuild: ensure full rebuild when the compiler is updated 2020-05-12 13:28:33 +09:00
MAINTAINERS scsi: Remove SCSI CDROM MAINTAINERS entry 2021-09-13 22:15:48 -04:00
Makefile Linux 5.15-rc1 2021-09-12 16:28:37 -07:00
README Drop all 00-INDEX files from Documentation/ 2018-09-09 15:08:58 -06:00

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.