Skip to content

Commit 71bb9ab

Browse files
ahunter6martinkpetersen
authored andcommitted
scsi: ufs: Fix runtime PM messages never-ending cycle
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/[email protected] Cc: [email protected] Signed-off-by: Adrian Hunter <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent af4edb1 commit 71bb9ab

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

drivers/scsi/ufs/ufshcd.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,12 @@ static void ufshcd_print_pwr_info(struct ufs_hba *hba)
583583
"INVALID MODE",
584584
};
585585

586-
dev_err(hba->dev, "%s:[RX, TX]: gear=[%d, %d], lane[%d, %d], pwr[%s, %s], rate = %d\n",
586+
/*
587+
* Using dev_dbg to avoid messages during runtime PM to avoid
588+
* never-ending cycles of messages written back to storage by user space
589+
* causing runtime resume, causing more messages and so on.
590+
*/
591+
dev_dbg(hba->dev, "%s:[RX, TX]: gear=[%d, %d], lane[%d, %d], pwr[%s, %s], rate = %d\n",
587592
__func__,
588593
hba->pwr_info.gear_rx, hba->pwr_info.gear_tx,
589594
hba->pwr_info.lane_rx, hba->pwr_info.lane_tx,
@@ -5022,6 +5027,12 @@ static int ufshcd_slave_configure(struct scsi_device *sdev)
50225027
pm_runtime_get_noresume(&sdev->sdev_gendev);
50235028
else if (ufshcd_is_rpm_autosuspend_allowed(hba))
50245029
sdev->rpm_autosuspend = 1;
5030+
/*
5031+
* Do not print messages during runtime PM to avoid never-ending cycles
5032+
* of messages written back to storage by user space causing runtime
5033+
* resume, causing more messages and so on.
5034+
*/
5035+
sdev->silence_suspend = 1;
50255036

50265037
ufshcd_crypto_register(hba, q);
50275038

@@ -7384,7 +7395,13 @@ static u32 ufshcd_find_max_sup_active_icc_level(struct ufs_hba *hba,
73847395

73857396
if (!hba->vreg_info.vcc || !hba->vreg_info.vccq ||
73867397
!hba->vreg_info.vccq2) {
7387-
dev_err(hba->dev,
7398+
/*
7399+
* Using dev_dbg to avoid messages during runtime PM to avoid
7400+
* never-ending cycles of messages written back to storage by
7401+
* user space causing runtime resume, causing more messages and
7402+
* so on.
7403+
*/
7404+
dev_dbg(hba->dev,
73887405
"%s: Regulator capability was not set, actvIccLevel=%d",
73897406
__func__, icc_level);
73907407
goto out;

0 commit comments

Comments
 (0)