diff mbox series

[v6,3/8] scsi: ufs-qcom: Fix schedule while atomic error in ufs_qcom_dump_dbg_regs

Message ID 1595504787-19429-4-git-send-email-cang@codeaurora.org (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Can Guo July 23, 2020, 11:46 a.m. UTC
Dumping testbus registers needs to sleep a bit intermittently as there are
too many of them. Skip them for those contexts where sleep is not allowed.

Signed-off-by: Can Guo <cang@codeaurora.org>
---
 drivers/scsi/ufs/ufs-qcom.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Avri Altman July 27, 2020, 1:05 p.m. UTC | #1
> Dumping testbus registers needs to sleep a bit intermittently as there are
> too many of them. Skip them for those contexts where sleep is not allowed.
> 
> Signed-off-by: Can Guo <cang@codeaurora.org>
> ---
>  drivers/scsi/ufs/ufs-qcom.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
> index 7da27ee..7831b2b 100644
> --- a/drivers/scsi/ufs/ufs-qcom.c
> +++ b/drivers/scsi/ufs/ufs-qcom.c
> @@ -1651,13 +1651,16 @@ static void ufs_qcom_dump_dbg_regs(struct
> ufs_hba *hba)
>         ufshcd_dump_regs(hba, REG_UFS_SYS1CLK_1US, 16 * 4,
>                          "HCI Vendor Specific Registers ");
> 
> -       /* 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);
> -       udelay(1000);
> -       ufs_qcom_testbus_read(hba);
> -       udelay(1000);
> -       ufs_qcom_print_unipro_testbus(hba);
> -       udelay(1000);
> +
> +       if (in_task()) {
> +               /* sleep a bit intermittently as we are dumping too much data */
> +               usleep_range(1000, 1100);
> +               ufs_qcom_testbus_read(hba);
> +               usleep_range(1000, 1100);
> +               ufs_qcom_print_unipro_testbus(hba);
> +               usleep_range(1000, 1100);
> +       }
>  }
How about moving the intermittent sleep out of the check if preemption is disabled?
And maybe then you need to switch back to uedlay?
Can Guo July 28, 2020, 2:21 a.m. UTC | #2
Hi Avri,

On 2020-07-27 21:05, Avri Altman wrote:
>> Dumping testbus registers needs to sleep a bit intermittently as there 
>> are
>> too many of them. Skip them for those contexts where sleep is not 
>> allowed.
>> 
>> Signed-off-by: Can Guo <cang@codeaurora.org>
>> ---
>>  drivers/scsi/ufs/ufs-qcom.c | 15 +++++++++------
>>  1 file changed, 9 insertions(+), 6 deletions(-)
>> 
>> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
>> index 7da27ee..7831b2b 100644
>> --- a/drivers/scsi/ufs/ufs-qcom.c
>> +++ b/drivers/scsi/ufs/ufs-qcom.c
>> @@ -1651,13 +1651,16 @@ static void ufs_qcom_dump_dbg_regs(struct
>> ufs_hba *hba)
>>         ufshcd_dump_regs(hba, REG_UFS_SYS1CLK_1US, 16 * 4,
>>                          "HCI Vendor Specific Registers ");
>> 
>> -       /* 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);
>> -       udelay(1000);
>> -       ufs_qcom_testbus_read(hba);
>> -       udelay(1000);
>> -       ufs_qcom_print_unipro_testbus(hba);
>> -       udelay(1000);
>> +
>> +       if (in_task()) {
>> +               /* sleep a bit intermittently as we are dumping too 
>> much data */
>> +               usleep_range(1000, 1100);
>> +               ufs_qcom_testbus_read(hba);
>> +               usleep_range(1000, 1100);
>> +               ufs_qcom_print_unipro_testbus(hba);
>> +               usleep_range(1000, 1100);
>> +       }
>>  }
> How about moving the intermittent sleep out of the check if preemption
> is disabled?
> And maybe then you need to switch back to uedlay?

I will just remove all the testbus prints in next version to save us 
time here.

Thanks,

Can Guo.
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 7da27ee..7831b2b 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -1651,13 +1651,16 @@  static void ufs_qcom_dump_dbg_regs(struct ufs_hba *hba)
 	ufshcd_dump_regs(hba, REG_UFS_SYS1CLK_1US, 16 * 4,
 			 "HCI Vendor Specific Registers ");
 
-	/* 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);
-	udelay(1000);
-	ufs_qcom_testbus_read(hba);
-	udelay(1000);
-	ufs_qcom_print_unipro_testbus(hba);
-	udelay(1000);
+
+	if (in_task()) {
+		/* sleep a bit intermittently as we are dumping too much data */
+		usleep_range(1000, 1100);
+		ufs_qcom_testbus_read(hba);
+		usleep_range(1000, 1100);
+		ufs_qcom_print_unipro_testbus(hba);
+		usleep_range(1000, 1100);
+	}
 }
 
 /**