]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Apr 2022 15:29:18 +0000 (17:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Apr 2022 15:29:18 +0000 (17:29 +0200)
added patches:
scsi-core-sd-add-silence_suspend-flag-to-suppress-some-pm-messages.patch
scsi-ufs-fix-runtime-pm-messages-never-ending-cycle.patch

queue-5.15/scsi-core-sd-add-silence_suspend-flag-to-suppress-some-pm-messages.patch [new file with mode: 0644]
queue-5.15/scsi-ufs-fix-runtime-pm-messages-never-ending-cycle.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/scsi-core-sd-add-silence_suspend-flag-to-suppress-some-pm-messages.patch b/queue-5.15/scsi-core-sd-add-silence_suspend-flag-to-suppress-some-pm-messages.patch
new file mode 100644 (file)
index 0000000..10dcc72
--- /dev/null
@@ -0,0 +1,78 @@
+From af4edb1d50c6d1044cb34bc43621411b7ba2cffe Mon Sep 17 00:00:00 2001
+From: Adrian Hunter <adrian.hunter@intel.com>
+Date: Mon, 28 Feb 2022 13:36:51 +0200
+Subject: scsi: core: sd: Add silence_suspend flag to suppress some PM messages
+
+From: Adrian Hunter <adrian.hunter@intel.com>
+
+commit af4edb1d50c6d1044cb34bc43621411b7ba2cffe upstream.
+
+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: Adrian Hunter <adrian.hunter@intel.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/scsi/scsi_error.c  |    9 +++++++--
+ drivers/scsi/sd.c          |    6 ++++--
+ include/scsi/scsi_device.h |    1 +
+ 3 files changed, 12 insertions(+), 4 deletions(-)
+
+--- a/drivers/scsi/scsi_error.c
++++ b/drivers/scsi/scsi_error.c
+@@ -485,8 +485,13 @@ static void scsi_report_sense(struct scs
+               if (sshdr->asc == 0x29) {
+                       evt_type = SDEV_EVT_POWER_ON_RESET_OCCURRED;
+-                      sdev_printk(KERN_WARNING, sdev,
+-                                  "Power-on or device reset occurred\n");
++                      /*
++                       * 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");
+               }
+               if (sshdr->asc == 0x2a && sshdr->ascq == 0x01) {
+--- a/drivers/scsi/sd.c
++++ b/drivers/scsi/sd.c
+@@ -3628,7 +3628,8 @@ static int sd_suspend_common(struct devi
+               return 0;
+       if (sdkp->WCE && sdkp->media_present) {
+-              sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
++              if (!sdkp->device->silence_suspend)
++                      sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
+               ret = sd_sync_cache(sdkp, &sshdr);
+               if (ret) {
+@@ -3650,7 +3651,8 @@ static int sd_suspend_common(struct devi
+       }
+       if (sdkp->device->manage_start_stop) {
+-              sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
++              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);
+               if (ignore_stop_errors)
+--- a/include/scsi/scsi_device.h
++++ b/include/scsi/scsi_device.h
+@@ -206,6 +206,7 @@ struct scsi_device {
+       unsigned rpm_autosuspend:1;     /* Enable runtime autosuspend at device
+                                        * creation time */
+       unsigned ignore_media_change:1; /* Ignore MEDIA CHANGE on resume */
++      unsigned silence_suspend:1;     /* Do not print runtime PM related messages */
+       bool offline_already;           /* Device offline message logged */
diff --git a/queue-5.15/scsi-ufs-fix-runtime-pm-messages-never-ending-cycle.patch b/queue-5.15/scsi-ufs-fix-runtime-pm-messages-never-ending-cycle.patch
new file mode 100644 (file)
index 0000000..6cbbb02
--- /dev/null
@@ -0,0 +1,95 @@
+From 71bb9ab6e3511b7bb98678a19eb8cf1ccbf3ca2f Mon Sep 17 00:00:00 2001
+From: Adrian Hunter <adrian.hunter@intel.com>
+Date: Mon, 28 Feb 2022 13:36:52 +0200
+Subject: scsi: ufs: Fix runtime PM messages never-ending cycle
+
+From: Adrian Hunter <adrian.hunter@intel.com>
+
+commit 71bb9ab6e3511b7bb98678a19eb8cf1ccbf3ca2f upstream.
+
+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 suppress them.
+
+UFS driver messages are changes to from dev_err() to dev_dbg() which means
+they will not display unless activated by dynamic debug of building with
+-DDEBUG.
+
+sdev->silence_suspend is set to skip messages from sd_suspend_common()
+"Synchronizing SCSI cache", "Stopping disk" and scsi_report_sense()
+"Power-on or device reset occurred" message (Note, that message appears
+when the LUN is accessed after runtime PM, not during runtime PM)
+
+ Example messages from Ubuntu 21.10:
+
+ $ dmesg | tail
+ [ 1620.380071] ufshcd 0000:00:12.5: ufshcd_print_pwr_info:[RX, TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE], rate = 0
+ [ 1620.408825] ufshcd 0000:00:12.5: ufshcd_print_pwr_info:[RX, TX]: gear=[4, 4], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2
+ [ 1620.409020] ufshcd 0000:00:12.5: ufshcd_find_max_sup_active_icc_level: Regulator capability was not set, actvIccLevel=0
+ [ 1620.409524] sd 0:0:0:0: Power-on or device reset occurred
+ [ 1622.938794] sd 0:0:0:0: [sda] Synchronizing SCSI cache
+ [ 1622.939184] ufs_device_wlun 0:0:0:49488: Power-on or device reset occurred
+ [ 1625.183175] ufshcd 0000:00:12.5: ufshcd_print_pwr_info:[RX, TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE], rate = 0
+ [ 1625.208041] ufshcd 0000:00:12.5: ufshcd_print_pwr_info:[RX, TX]: gear=[4, 4], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2
+ [ 1625.208311] ufshcd 0000:00:12.5: ufshcd_find_max_sup_active_icc_level: Regulator capability was not set, actvIccLevel=0
+ [ 1625.209035] sd 0:0:0:0: Power-on or device reset occurred
+
+Note for stable: depends on patch "scsi: core: sd: Add silence_suspend flag
+to suppress some PM messages".
+
+Link: https://lore.kernel.org/r/20220228113652.970857-3-adrian.hunter@intel.com
+Cc: stable@vger.kernel.org
+Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/scsi/ufs/ufshcd.c |   21 +++++++++++++++++++--
+ 1 file changed, 19 insertions(+), 2 deletions(-)
+
+--- a/drivers/scsi/ufs/ufshcd.c
++++ b/drivers/scsi/ufs/ufshcd.c
+@@ -576,7 +576,12 @@ static void ufshcd_print_pwr_info(struct
+               "INVALID MODE",
+       };
+-      dev_err(hba->dev, "%s:[RX, TX]: gear=[%d, %d], lane[%d, %d], pwr[%s, %s], rate = %d\n",
++      /*
++       * Using dev_dbg to avoid messages during runtime PM to avoid
++       * never-ending cycles of messages written back to storage by user space
++       * causing runtime resume, causing more messages and so on.
++       */
++      dev_dbg(hba->dev, "%s:[RX, TX]: gear=[%d, %d], lane[%d, %d], pwr[%s, %s], rate = %d\n",
+                __func__,
+                hba->pwr_info.gear_rx, hba->pwr_info.gear_tx,
+                hba->pwr_info.lane_rx, hba->pwr_info.lane_tx,
+@@ -4967,6 +4972,12 @@ static int ufshcd_slave_configure(struct
+               pm_runtime_get_noresume(&sdev->sdev_gendev);
+       else if (ufshcd_is_rpm_autosuspend_allowed(hba))
+               sdev->rpm_autosuspend = 1;
++      /*
++       * Do not print messages during runtime PM to avoid never-ending cycles
++       * of messages written back to storage by user space causing runtime
++       * resume, causing more messages and so on.
++       */
++      sdev->silence_suspend = 1;
+       ufshcd_crypto_setup_rq_keyslot_manager(hba, q);
+@@ -7199,7 +7210,13 @@ static u32 ufshcd_find_max_sup_active_ic
+       if (!hba->vreg_info.vcc || !hba->vreg_info.vccq ||
+                                               !hba->vreg_info.vccq2) {
+-              dev_err(hba->dev,
++              /*
++               * Using dev_dbg to avoid messages during runtime PM to avoid
++               * never-ending cycles of messages written back to storage by
++               * user space causing runtime resume, causing more messages and
++               * so on.
++               */
++              dev_dbg(hba->dev,
+                       "%s: Regulator capability was not set, actvIccLevel=%d",
+                                                       __func__, icc_level);
+               goto out;
index a030685078b163ca31dcdc7b1ad7b7e4ab90afa1..78637d747e98789da3c035469bbcd798f54ed23d 100644 (file)
@@ -84,3 +84,5 @@ mm-fs-fix-lru_cache_disabled-race-in-bh_lru.patch
 mm-pages_alloc.c-don-t-create-zone_movable-beyond-the-end-of-a-node.patch
 mm-invalidate-hwpoison-page-cache-page-in-fault-path.patch
 mempolicy-mbind_range-set_policy-after-vma_merge.patch
+scsi-core-sd-add-silence_suspend-flag-to-suppress-some-pm-messages.patch
+scsi-ufs-fix-runtime-pm-messages-never-ending-cycle.patch