linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs-qcom: Fix scheduling while atomic issue
@ 2020-05-25 20:41 Jeffrey Hugo
  2020-05-26  6:25 ` Avri Altman
  2020-05-27  2:12 ` Martin K. Petersen
  0 siblings, 2 replies; 4+ messages in thread
From: Jeffrey Hugo @ 2020-05-25 20:41 UTC (permalink / raw)
  To: agross, bjorn.andersson, alim.akhtar, avri.altman, jejb,
	martin.petersen, subhashj, venkatg
  Cc: linux-arm-msm, linux-scsi, linux-kernel, 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

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")
Signed-off-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
---
 drivers/scsi/ufs/ufs-qcom.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 19aa5c44e0da..f938867301a0 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -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);
 }
 
 /**
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] scsi: ufs-qcom: Fix scheduling while atomic issue
  2020-05-25 20:41 [PATCH] scsi: ufs-qcom: Fix scheduling while atomic issue Jeffrey Hugo
@ 2020-05-26  6:25 ` Avri Altman
  2020-05-26  9:41   ` Bean Huo
  2020-05-27  2:12 ` Martin K. Petersen
  1 sibling, 1 reply; 4+ messages in thread
From: Avri Altman @ 2020-05-26  6:25 UTC (permalink / raw)
  To: Jeffrey Hugo, agross, bjorn.andersson, alim.akhtar, jejb,
	martin.petersen, subhashj, venkatg
  Cc: linux-arm-msm, linux-scsi, linux-kernel

 
> 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")
> Signed-off-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: ufs-qcom: Fix scheduling while atomic issue
  2020-05-26  6:25 ` Avri Altman
@ 2020-05-26  9:41   ` Bean Huo
  0 siblings, 0 replies; 4+ messages in thread
From: Bean Huo @ 2020-05-26  9:41 UTC (permalink / raw)
  To: Avri Altman, Jeffrey Hugo, agross, bjorn.andersson, alim.akhtar,
	jejb, martin.petersen, subhashj, venkatg
  Cc: linux-arm-msm, linux-scsi, linux-kernel

On Tue, 2020-05-26 at 06:25 +0000, Avri Altman wrote:
>  
> > 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")
> > Signed-off-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
> 
> Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: ufs-qcom: Fix scheduling while atomic issue
  2020-05-25 20:41 [PATCH] scsi: ufs-qcom: Fix scheduling while atomic issue Jeffrey Hugo
  2020-05-26  6:25 ` Avri Altman
@ 2020-05-27  2:12 ` Martin K. Petersen
  1 sibling, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-05-27  2:12 UTC (permalink / raw)
  To: agross, Jeffrey Hugo, avri.altman, venkatg, bjorn.andersson,
	subhashj, alim.akhtar, jejb
  Cc: Martin K . Petersen, linux-scsi, linux-kernel, linux-arm-msm

On Mon, 25 May 2020 13:41:25 -0700, Jeffrey Hugo wrote:

> 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

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-27  2:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25 20:41 [PATCH] scsi: ufs-qcom: Fix scheduling while atomic issue Jeffrey Hugo
2020-05-26  6:25 ` Avri Altman
2020-05-26  9:41   ` Bean Huo
2020-05-27  2:12 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).