Skip to content

Commit 54c814c

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Start the RTC update work later
The RTC update work involves runtime resuming the UFS controller. Hence, only start the RTC update work after runtime power management in the UFS driver has been fully initialized. This patch fixes the following kernel crash: Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP Workqueue: events ufshcd_rtc_work Call trace: _raw_spin_lock_irqsave+0x34/0x8c (P) pm_runtime_get_if_active+0x24/0x9c (L) pm_runtime_get_if_active+0x24/0x9c ufshcd_rtc_work+0x138/0x1b4 process_one_work+0x148/0x288 worker_thread+0x2cc/0x3d4 kthread+0x110/0x114 ret_from_fork+0x10/0x20 Reported-by: Neil Armstrong <[email protected]> Closes: https://lore.kernel.org/linux-scsi/[email protected]/ Fixes: 6bf999e ("scsi: ufs: core: Add UFS RTC support") Cc: Bean Huo <[email protected]> Cc: [email protected] Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Peter Wang <[email protected]> Reviewed-by: Bean Huo <[email protected]> Tested-by: Neil Armstrong <[email protected]> # on SM8650-HDK Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 7ce3e61 commit 54c814c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8636,6 +8636,14 @@ static int ufshcd_add_lus(struct ufs_hba *hba)
86368636
ufshcd_init_clk_scaling_sysfs(hba);
86378637
}
86388638

8639+
/*
8640+
* The RTC update code accesses the hba->ufs_device_wlun->sdev_gendev
8641+
* pointer and hence must only be started after the WLUN pointer has
8642+
* been initialized by ufshcd_scsi_add_wlus().
8643+
*/
8644+
schedule_delayed_work(&hba->ufs_rtc_update_work,
8645+
msecs_to_jiffies(UFS_RTC_UPDATE_INTERVAL_MS));
8646+
86398647
ufs_bsg_probe(hba);
86408648
scsi_scan_host(hba->host);
86418649

@@ -8795,8 +8803,6 @@ static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params)
87958803
ufshcd_force_reset_auto_bkops(hba);
87968804

87978805
ufshcd_set_timestamp_attr(hba);
8798-
schedule_delayed_work(&hba->ufs_rtc_update_work,
8799-
msecs_to_jiffies(UFS_RTC_UPDATE_INTERVAL_MS));
88008806

88018807
/* Gear up to HS gear if supported */
88028808
if (hba->max_pwr_info.is_valid) {

0 commit comments

Comments
 (0)