Skip to contentSkip to conversation

scsi: ufs-qcom: Fix scheduling while atomic issue

PATCH Applied Jeffrey Hugo 4 participants 4 messages May 25, 2020 – May 27, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: ufs-qcom: Fix scheduling while atomic issue

ufs_qcom_dump_dbg_regs() uses usleep_range, a sleeping function, but can be called from atomic context in the following flow:

ufshcd_intr -> ufshcd_sl_intr -> ufshcd_check_errors -> ufshcd_print_host_regs -> ufshcd_vops_dbg_register_dump -> ufs_qcom_dump_dbg_regs

This causes a boot crash on the Lenovo Miix 630 when the interrupt is handled on the idle thread.

Fix the issue by switching to udelay().

Fixes 9c46b8676271 ("scsi: ufs-qcom: dump additional testbus registers")
---
 drivers/scsi/ufs/ufs-qcom.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/ufs/ufs-qcom.c +3 -3
index 19aa5c44e0da..f938867301a0 100644
@@ -1658,11 +1658,11 @@ static void ufs_qcom_dump_dbg_regs(struct ufs_hba *hba)
 
 	/* sleep a bit intermittently as we are dumping too much data */
 	ufs_qcom_print_hw_debug_reg_all(hba, NULL, ufs_qcom_dump_regs_wrapper);
-	usleep_range(1000, 1100);
+	udelay(1000);
 	ufs_qcom_testbus_read(hba);
-	usleep_range(1000, 1100);
+	udelay(1000);
 	ufs_qcom_print_unipro_testbus(hba);
-	usleep_range(1000, 1100);
+	udelay(1000);
 }
 
 /**
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines

ufs_qcom_dump_dbg_regs() uses usleep_range, a sleeping function, but can be called from atomic context in the following flow:

ufshcd_intr -> ufshcd_sl_intr -> ufshcd_check_errors -> ufshcd_print_host_regs -> ufshcd_vops_dbg_register_dump -> ufs_qcom_dump_dbg_regs

Quoted 7 lines

This causes a boot crash on the Lenovo Miix 630 when the interrupt is handled on the idle thread.

Fix the issue by switching to udelay().

Fixes 9c46b8676271 ("scsi: ufs-qcom: dump additional testbus registers")
Reviewed-by
#2 lore raw
Quoted 13 lines · Avri Altman
Quoted 13 lines

ufs_qcom_dump_dbg_regs() uses usleep_range, a sleeping function, but can
be called from atomic context in the following flow:

ufshcd_intr -> ufshcd_sl_intr -> ufshcd_check_errors -> ufshcd_print_host_regs -> ufshcd_vops_dbg_register_dump -> ufs_qcom_dump_dbg_regs

This causes a boot crash on the Lenovo Miix 630 when the interrupt is
handled on the idle thread.

Quoted 7 lines
Quoted 5 lines

Fix the issue by switching to udelay().

Fixes 9c46b8676271 ("scsi: ufs-qcom: dump additional testbus

registers")

#3 lore raw
In reply to Jeffrey Hugo
Quoted 8 lines · Jeffrey Hugo

ufs_qcom_dump_dbg_regs() uses usleep_range, a sleeping function, but can be called from atomic context in the following flow:

ufshcd_intr -> ufshcd_sl_intr -> ufshcd_check_errors -> ufshcd_print_host_regs -> ufshcd_vops_dbg_register_dump -> ufs_qcom_dump_dbg_regs

[...]

Applied to 5.8/scsi-queue, thanks!

[1/1] scsi: ufs-qcom: Fix scheduling while atomic issue

      https://git.kernel.org/mkp/scsi/c/3be60b564de4
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering