Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit 33adfcfc authored by Adrian Hunter's avatar Adrian Hunter Committed by Manu Suresh
Browse files

FROMGIT: scsi: core: sd: Add silence_suspend flag to suppress some PM messages

Kernel messages produced during runtime PM can cause a never-ending cycle
because user space utilities (e.g. journald or rsyslog) write the messages
back to storage, causing runtime resume, more messages, and so on.

Messages that tell of things that are expected to happen are arguably
unnecessary, so add a flag to suppress them. This flag is used by the UFS
driver.

Link: https://lore.kernel.org/r/20220228113652.970857-2-adrian.hunter@intel.com


Cc: stable@vger.kernel.org
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit af4edb1d50c6d1044cb34bc43621411b7ba2cffe git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git

 for-next)
Change-Id: I8834c9d71618fd04635804779a41117629a75166
Signed-off-by: default avatarBart Van Assche <bvanassche@google.com>
parent 33d0beab
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -440,6 +440,11 @@ static void scsi_report_sense(struct scsi_device *sdev,

		if (sshdr->asc == 0x29) {
			evt_type = SDEV_EVT_POWER_ON_RESET_OCCURRED;
			/*
			 * Do not print message if it is an expected side-effect
			 * of runtime PM.
			 */
			if (!sdev->silence_suspend)
				sdev_printk(KERN_WARNING, sdev,
					    "Power-on or device reset occurred\n");
		}
+4 −2
Original line number Diff line number Diff line
@@ -3572,6 +3572,7 @@ static int sd_suspend_common(struct device *dev, bool ignore_stop_errors)
		return 0;

	if (sdkp->WCE && sdkp->media_present) {
		if (!sdkp->device->silence_suspend)
			sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
		ret = sd_sync_cache(sdkp, &sshdr);

@@ -3594,6 +3595,7 @@ static int sd_suspend_common(struct device *dev, bool ignore_stop_errors)
	}

	if (sdkp->device->manage_start_stop) {
		if (!sdkp->device->silence_suspend)
			sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
		/* an error is not worth aborting a system sleep */
		ret = sd_start_stop_device(sdkp, 0);
+1 −0
Original line number Diff line number Diff line
@@ -203,6 +203,7 @@ struct scsi_device {
	unsigned unmap_limit_for_ws:1;	/* Use the UNMAP limit for WRITE SAME */
	unsigned rpm_autosuspend:1;	/* Enable runtime autosuspend at device
					 * creation time */
	unsigned silence_suspend:1;	/* Do not print runtime PM related messages */
	atomic_t disk_events_disable_depth; /* disable depth for disk events */

	DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */