* Re: [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully
@ 2020-08-07 9:33 Markus Elfring
2020-08-07 13:01 ` Can Guo
0 siblings, 1 reply; 17+ messages in thread
From: Markus Elfring @ 2020-08-07 9:33 UTC (permalink / raw)
To: Can Guo, Stanley Chu, kernel-team, linux-arm-kernel,
linux-mediatek, linux-scsi
Cc: Rajendra Nayak, Bart Van Assche, Martin K. Petersen,
Saravana Kannan, James E. J. Bottomley, kernel-janitors,
Bao D. Nguyen, linux-kernel, Avri Altman, Mark Salyzyn,
Alim Akhtar, Matthias Brugger, Bean Huo, Hongwu Su, Asutosh Das
> … To fix it, …
I propose to replace this wording by the tag “Fixes”.
> … "mannually", …
Please avoid a typo:
… "manually", …
Regards,
Markus
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully
2020-08-07 9:33 [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully Markus Elfring
2020-08-07 13:01 ` Can Guo
(?)
@ 2020-08-07 13:01 ` Can Guo
0 siblings, 0 replies; 17+ messages in thread
From: Can Guo @ 2020-08-07 13:01 UTC (permalink / raw)
To: Markus Elfring
Cc: Matthias Brugger, Rajendra Nayak, Bart Van Assche, linux-scsi,
Saravana Kannan, James E. J. Bottomley, kernel-janitors,
linux-kernel, Bao D. Nguyen, Avri Altman, Mark Salyzyn,
linux-mediatek, Hongwu Su, Alim Akhtar, Martin K. Petersen,
Bean Huo, Stanley Chu, kernel-team, linux-arm-kernel, Asutosh Das
Hi Markus,
On 2020-08-07 17:33, Markus Elfring wrote:
>> … To fix it, …
>
> I propose to replace this wording by the tag “Fixes”.
>
>
>> … "mannually", …
>
> Please avoid a typo:
> … "manually", …
>
>
> Regards,
> Markus
Thanks, will fix these in next version.
Regards,
Can Guo.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully
@ 2020-08-07 13:01 ` Can Guo
0 siblings, 0 replies; 17+ messages in thread
From: Can Guo @ 2020-08-07 13:01 UTC (permalink / raw)
To: Markus Elfring
Cc: Matthias Brugger, Rajendra Nayak, Bart Van Assche, linux-scsi,
Saravana Kannan, James E. J. Bottomley, kernel-janitors,
linux-kernel, Bao D. Nguyen, Avri Altman, Mark Salyzyn,
linux-mediatek, Hongwu Su, Alim Akhtar, Martin K. Petersen,
Bean Huo, Stanley Chu, kernel-team, linux-arm-kernel, Asutosh Das
Hi Markus,
On 2020-08-07 17:33, Markus Elfring wrote:
>> … To fix it, …
>
> I propose to replace this wording by the tag “Fixes”.
>
>
>> … "mannually", …
>
> Please avoid a typo:
> … "manually", …
>
>
> Regards,
> Markus
Thanks, will fix these in next version.
Regards,
Can Guo.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully
@ 2020-08-07 13:01 ` Can Guo
0 siblings, 0 replies; 17+ messages in thread
From: Can Guo @ 2020-08-07 13:01 UTC (permalink / raw)
To: Markus Elfring
Cc: Stanley Chu, kernel-team, linux-arm-kernel, linux-mediatek,
linux-scsi, linux-kernel, kernel-janitors, Alim Akhtar,
Asutosh Das, Avri Altman, Bao D. Nguyen, Bart Van Assche,
Bean Huo, Hongwu Su, James E. J. Bottomley, Mark Salyzyn,
Martin K. Petersen, Matthias Brugger, Rajendra Nayak,
Saravana Kannan
Hi Markus,
On 2020-08-07 17:33, Markus Elfring wrote:
>> … To fix it, …
>
> I propose to replace this wording by the tag “Fixes”.
>
>
>> … "mannually", …
>
> Please avoid a typo:
> … "manually", …
>
>
> Regards,
> Markus
Thanks, will fix these in next version.
Regards,
Can Guo.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully
@ 2020-08-07 13:01 ` Can Guo
0 siblings, 0 replies; 17+ messages in thread
From: Can Guo @ 2020-08-07 13:01 UTC (permalink / raw)
To: Markus Elfring
Cc: Matthias Brugger, Rajendra Nayak, Bart Van Assche, linux-scsi,
Saravana Kannan, James E. J. Bottomley, kernel-janitors,
linux-kernel, Bao D. Nguyen, Avri Altman, Mark Salyzyn,
linux-mediatek, Hongwu Su, Alim Akhtar, Martin K. Petersen,
Bean Huo, Stanley Chu, kernel-team, linux-arm-kernel, Asutosh Das
Hi Markus,
On 2020-08-07 17:33, Markus Elfring wrote:
>> … To fix it, …
>
> I propose to replace this wording by the tag “Fixes”.
>
>
>> … "mannually", …
>
> Please avoid a typo:
> … "manually", …
>
>
> Regards,
> Markus
Thanks, will fix these in next version.
Regards,
Can Guo.
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [9/9] scsi: ufs: Properly release resources if a task is aborted successfully
2020-08-07 13:01 ` Can Guo
@ 2020-08-09 18:00 ` Markus Elfring
-1 siblings, 0 replies; 17+ messages in thread
From: Markus Elfring @ 2020-08-09 18:00 UTC (permalink / raw)
To: Can Guo, Stanley Chu, Asutosh Das, linux-arm-kernel,
linux-mediatek, linux-scsi, kernel-team
Cc: Rajendra Nayak, Bart Van Assche, Martin K. Petersen,
Saravana Kannan, James E. J. Bottomley, kernel-janitors,
linux-kernel, Bao D. Nguyen, Avri Altman, Mark Salyzyn,
Alim Akhtar, Matthias Brugger, Hongwu Su, Bean Huo
> Thanks, will fix these in next version.
Thanks for your adjustment of the proposed commit message.
Should the corresponding patch be marked with an other version number?
https://lore.kernel.org/linux-arm-kernel/1596975355-39813-10-git-send-email-cang@codeaurora.org/
https://lore.kernel.org/patchwork/patch/1285629/
https://lkml.org/lkml/2020/8/9/87
Should a cover letter be provided for such a patch series?
Regards,
Markus
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [9/9] scsi: ufs: Properly release resources if a task is aborted successfully
@ 2020-08-09 18:00 ` Markus Elfring
0 siblings, 0 replies; 17+ messages in thread
From: Markus Elfring @ 2020-08-09 18:00 UTC (permalink / raw)
To: Can Guo, Stanley Chu, Asutosh Das, linux-arm-kernel,
linux-mediatek, linux-scsi, kernel-team
Cc: Rajendra Nayak, Bart Van Assche, Martin K. Petersen,
Saravana Kannan, James E. J. Bottomley, kernel-janitors,
linux-kernel, Bao D. Nguyen, Avri Altman, Mark Salyzyn,
Alim Akhtar, Matthias Brugger, Hongwu Su, Bean Huo
> Thanks, will fix these in next version.
Thanks for your adjustment of the proposed commit message.
Should the corresponding patch be marked with an other version number?
https://lore.kernel.org/linux-arm-kernel/1596975355-39813-10-git-send-email-cang@codeaurora.org/
https://lore.kernel.org/patchwork/patch/1285629/
https://lkml.org/lkml/2020/8/9/87
Should a cover letter be provided for such a patch series?
Regards,
Markus
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [9/9] scsi: ufs: Properly release resources if a task is aborted successfully
2020-08-09 18:00 ` Markus Elfring
(?)
(?)
@ 2020-08-10 0:48 ` Can Guo
-1 siblings, 0 replies; 17+ messages in thread
From: Can Guo @ 2020-08-10 0:48 UTC (permalink / raw)
To: Markus Elfring
Cc: Matthias Brugger, Rajendra Nayak, Bart Van Assche, linux-scsi,
Saravana Kannan, James E. J. Bottomley, kernel-janitors,
linux-kernel, Bao D. Nguyen, Avri Altman, Mark Salyzyn,
linux-mediatek, Hongwu Su, Alim Akhtar, Martin K. Petersen,
Bean Huo, Stanley Chu, kernel-team, linux-arm-kernel, Asutosh Das
Hi Markus,
On 2020-08-10 02:00, Markus Elfring wrote:
>> Thanks, will fix these in next version.
>
> Thanks for your adjustment of the proposed commit message.
> Should the corresponding patch be marked with an other version number?
> https://lore.kernel.org/linux-arm-kernel/1596975355-39813-10-git-send-email-cang@codeaurora.org/
> https://lore.kernel.org/patchwork/patch/1285629/
> https://lkml.org/lkml/2020/8/9/87
>
> Should a cover letter be provided for such a patch series?
>
> Regards,
> Markus
I am not sure if you got my mails, this patch is included in
a patch series with other 8 changes and they do have a cover
letter. Let me re-send them to you.
Thanks,
Can Guo.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [9/9] scsi: ufs: Properly release resources if a task is aborted successfully
@ 2020-08-10 0:48 ` Can Guo
0 siblings, 0 replies; 17+ messages in thread
From: Can Guo @ 2020-08-10 0:48 UTC (permalink / raw)
To: Markus Elfring
Cc: Matthias Brugger, Rajendra Nayak, Bart Van Assche, linux-scsi,
Saravana Kannan, James E. J. Bottomley, kernel-janitors,
linux-kernel, Bao D. Nguyen, Avri Altman, Mark Salyzyn,
linux-mediatek, Hongwu Su, Alim Akhtar, Martin K. Petersen,
Bean Huo, Stanley Chu, kernel-team, linux-arm-kernel, Asutosh Das
Hi Markus,
On 2020-08-10 02:00, Markus Elfring wrote:
>> Thanks, will fix these in next version.
>
> Thanks for your adjustment of the proposed commit message.
> Should the corresponding patch be marked with an other version number?
> https://lore.kernel.org/linux-arm-kernel/1596975355-39813-10-git-send-email-cang@codeaurora.org/
> https://lore.kernel.org/patchwork/patch/1285629/
> https://lkml.org/lkml/2020/8/9/87
>
> Should a cover letter be provided for such a patch series?
>
> Regards,
> Markus
I am not sure if you got my mails, this patch is included in
a patch series with other 8 changes and they do have a cover
letter. Let me re-send them to you.
Thanks,
Can Guo.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [9/9] scsi: ufs: Properly release resources if a task is aborted successfully
@ 2020-08-10 0:48 ` Can Guo
0 siblings, 0 replies; 17+ messages in thread
From: Can Guo @ 2020-08-10 0:48 UTC (permalink / raw)
To: Markus Elfring
Cc: Stanley Chu, Asutosh Das, linux-arm-kernel, linux-mediatek,
linux-scsi, kernel-team, linux-kernel, kernel-janitors,
Alim Akhtar, Avri Altman, Bao D. Nguyen, Bart Van Assche,
Bean Huo, Hongwu Su, James E. J. Bottomley, Mark Salyzyn,
Martin K. Petersen, Matthias Brugger, Rajendra Nayak,
Saravana Kannan
Hi Markus,
On 2020-08-10 02:00, Markus Elfring wrote:
>> Thanks, will fix these in next version.
>
> Thanks for your adjustment of the proposed commit message.
> Should the corresponding patch be marked with an other version number?
> https://lore.kernel.org/linux-arm-kernel/1596975355-39813-10-git-send-email-cang@codeaurora.org/
> https://lore.kernel.org/patchwork/patch/1285629/
> https://lkml.org/lkml/2020/8/9/87
>
> Should a cover letter be provided for such a patch series?
>
> Regards,
> Markus
I am not sure if you got my mails, this patch is included in
a patch series with other 8 changes and they do have a cover
letter. Let me re-send them to you.
Thanks,
Can Guo.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [9/9] scsi: ufs: Properly release resources if a task is aborted successfully
@ 2020-08-10 0:48 ` Can Guo
0 siblings, 0 replies; 17+ messages in thread
From: Can Guo @ 2020-08-10 0:48 UTC (permalink / raw)
To: Markus Elfring
Cc: Matthias Brugger, Rajendra Nayak, Bart Van Assche, linux-scsi,
Saravana Kannan, James E. J. Bottomley, kernel-janitors,
linux-kernel, Bao D. Nguyen, Avri Altman, Mark Salyzyn,
linux-mediatek, Hongwu Su, Alim Akhtar, Martin K. Petersen,
Bean Huo, Stanley Chu, kernel-team, linux-arm-kernel, Asutosh Das
Hi Markus,
On 2020-08-10 02:00, Markus Elfring wrote:
>> Thanks, will fix these in next version.
>
> Thanks for your adjustment of the proposed commit message.
> Should the corresponding patch be marked with an other version number?
> https://lore.kernel.org/linux-arm-kernel/1596975355-39813-10-git-send-email-cang@codeaurora.org/
> https://lore.kernel.org/patchwork/patch/1285629/
> https://lkml.org/lkml/2020/8/9/87
>
> Should a cover letter be provided for such a patch series?
>
> Regards,
> Markus
I am not sure if you got my mails, this patch is included in
a patch series with other 8 changes and they do have a cover
letter. Let me re-send them to you.
Thanks,
Can Guo.
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v11 0/9] Fix up and simplify error recovery mechanism
@ 2020-08-09 12:15 Can Guo
2020-08-09 12:15 ` Can Guo
0 siblings, 1 reply; 17+ messages in thread
From: Can Guo @ 2020-08-09 12:15 UTC (permalink / raw)
To: asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
saravanak, salyzyn, cang
The changes have been tested with error injections of multiple error types (and
all kinds of mixture of them) during runtime, e.g. hibern8 enter/ exit error,
power mode change error and fatal/non-fatal error from IRQ context. During the
test, error injections happen randomly across all contexts, e.g. clk scaling,
clk gate/ungate, runtime suspend/resume and IRQ.
There are a few more fixes to resolve other minor problems based on the main
change, such as LINERESET handling and racing btw error handler and system
suspend/resume/shutdown, but they will be pushed after this series is taken,
due to there are already too many lines in these changes.
Change since v10:
- Incorporated Markus Elfring's comments
Change since v9:
- Fixed compilation warning from option [-Werror=implicit-fallthrough=] in patch "scsi: ufs: Fix a racing problem btw error handler and runtime PM ops"
Change since v8:
- Added one more fix to ufshcd_abort as requested by Stanley Chu
Change since v7:
- Incorporated Asutosh's comments
- Refined patch "scsi: ufs: Recover hba runtime PM error in error handler"
Change since v6:
- Modified change "scsi: ufs-qcom: Fix schedule while atomic error in ufs_qcom_dump_dbg_regs" to "scsi: ufs-qcom: Remove testbus dump in ufs_qcom_dump_dbg_regs"
Change since v5:
- Dropped change "scsi: ufs: Fix imbalanced scsi_block_reqs_cnt caused by ufshcd_hold()" as it is not quite related with this series
- Refined func ufshcd_err_handling_prepare in change "scsi: ufs: Recover hba runtime PM error in error handler"
Change since v4:
- Split the original change "ufs: ufs-qcom: Fix a few BUGs in func ufs_qcom_dump_dbg_regs()" to 2 small changes
Change since v3:
- Split the original change "scsi: ufs: Fix up and simplify error recovery mechanism" into 5 changes
Change since v2:
- Incorporate Bart's comment to change "scsi: ufs: Add checks before setting clk-gating states"
- Revised the commit msg of change "scsi: ufs: Fix up and simplify error recovery mechanism"
Change since v1:
- Fixed a compilation error in case that CONFIG_PM is N
Can Guo (9):
scsi: ufs: Add checks before setting clk-gating states
ufs: ufs-qcom: Fix race conditions caused by func
ufs_qcom_testbus_config
scsi: ufs-qcom: Remove testbus dump in ufs_qcom_dump_dbg_regs
scsi: ufs: Add some debug infos to ufshcd_print_host_state
scsi: ufs: Fix concurrency of error handler and other error recovery
paths
scsi: ufs: Recover hba runtime PM error in error handler
scsi: ufs: Move dumps in IRQ handler to error handler
scsi: ufs: Fix a racing problem btw error handler and runtime PM ops
scsi: ufs: Properly release resources if a task is aborted
successfully
drivers/scsi/ufs/ufs-qcom.c | 37 ----
drivers/scsi/ufs/ufs-sysfs.c | 1 +
drivers/scsi/ufs/ufshcd.c | 509 +++++++++++++++++++++++++++----------------
drivers/scsi/ufs/ufshcd.h | 14 ++
4 files changed, 339 insertions(+), 222 deletions(-)
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully
2020-08-09 12:15 [PATCH v11 0/9] Fix up and simplify error recovery mechanism Can Guo
2020-08-09 12:15 ` Can Guo
@ 2020-08-09 12:15 ` Can Guo
0 siblings, 0 replies; 17+ messages in thread
From: Can Guo @ 2020-08-09 12:15 UTC (permalink / raw)
To: asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
saravanak, salyzyn, cang
Cc: Santosh Y, Sujit Reddy Thumma, Bart Van Assche,
Martin K. Petersen, James E.J. Bottomley, open list,
James Bottomley, Avri Altman,
moderated list:ARM/Mediatek SoC support, Alim Akhtar, Dolev Raviv,
Matthias Brugger, Stanley Chu,
moderated list:ARM/Mediatek SoC support, Bean Huo
In current UFS task abort hook, namely ufshcd_abort(), if one task is
aborted successfully, clk_gating.active_reqs held by this task is not
decreased, which makes clk_gating.active_reqs stay above zero forever,
thus clock gating would never happen. Instead of releasing resources of
one task "manually", use the existing func __ufshcd_transfer_req_compl().
This change can also eliminate possible racing of scsi_dma_unmap() from
the real completion in IRQ handler path.
Fixes: 5a0b0cb9bee76 ("ufs: Add support for clock gating")
Signed-off-by: Can Guo <cang@codeaurora.org>
CC: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 9ebb5cd..efb40b1 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6636,11 +6636,8 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
goto out;
}
- scsi_dma_unmap(cmd);
-
spin_lock_irqsave(host->host_lock, flags);
- ufshcd_outstanding_req_clear(hba, tag);
- hba->lrb[tag].cmd = NULL;
+ __ufshcd_transfer_req_compl(hba, (1UL << tag));
spin_unlock_irqrestore(host->host_lock, flags);
out:
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully
@ 2020-08-09 12:15 ` Can Guo
0 siblings, 0 replies; 17+ messages in thread
From: Can Guo @ 2020-08-09 12:15 UTC (permalink / raw)
To: asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
saravanak, salyzyn, cang
Cc: Santosh Y, Sujit Reddy Thumma, Bart Van Assche,
Martin K. Petersen, James E.J. Bottomley, open list,
James Bottomley, Avri Altman,
moderated list:ARM/Mediatek SoC support, Alim Akhtar, Dolev Raviv,
Matthias Brugger, Stanley Chu,
moderated list:ARM/Mediatek SoC support, Bean Huo
In current UFS task abort hook, namely ufshcd_abort(), if one task is
aborted successfully, clk_gating.active_reqs held by this task is not
decreased, which makes clk_gating.active_reqs stay above zero forever,
thus clock gating would never happen. Instead of releasing resources of
one task "manually", use the existing func __ufshcd_transfer_req_compl().
This change can also eliminate possible racing of scsi_dma_unmap() from
the real completion in IRQ handler path.
Fixes: 5a0b0cb9bee76 ("ufs: Add support for clock gating")
Signed-off-by: Can Guo <cang@codeaurora.org>
CC: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 9ebb5cd..efb40b1 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6636,11 +6636,8 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
goto out;
}
- scsi_dma_unmap(cmd);
-
spin_lock_irqsave(host->host_lock, flags);
- ufshcd_outstanding_req_clear(hba, tag);
- hba->lrb[tag].cmd = NULL;
+ __ufshcd_transfer_req_compl(hba, (1UL << tag));
spin_unlock_irqrestore(host->host_lock, flags);
out:
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully
@ 2020-08-09 12:15 ` Can Guo
0 siblings, 0 replies; 17+ messages in thread
From: Can Guo @ 2020-08-09 12:15 UTC (permalink / raw)
To: asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
saravanak, salyzyn, cang
Cc: Stanley Chu, Alim Akhtar, Avri Altman, James E.J. Bottomley,
Martin K. Petersen, Matthias Brugger, Bean Huo, Bart Van Assche,
James Bottomley, Santosh Y, Sujit Reddy Thumma, Dolev Raviv,
open list, moderated list:ARM/Mediatek SoC support,
moderated list:ARM/Mediatek SoC support
In current UFS task abort hook, namely ufshcd_abort(), if one task is
aborted successfully, clk_gating.active_reqs held by this task is not
decreased, which makes clk_gating.active_reqs stay above zero forever,
thus clock gating would never happen. Instead of releasing resources of
one task "manually", use the existing func __ufshcd_transfer_req_compl().
This change can also eliminate possible racing of scsi_dma_unmap() from
the real completion in IRQ handler path.
Fixes: 5a0b0cb9bee76 ("ufs: Add support for clock gating")
Signed-off-by: Can Guo <cang@codeaurora.org>
CC: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 9ebb5cd..efb40b1 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6636,11 +6636,8 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
goto out;
}
- scsi_dma_unmap(cmd);
-
spin_lock_irqsave(host->host_lock, flags);
- ufshcd_outstanding_req_clear(hba, tag);
- hba->lrb[tag].cmd = NULL;
+ __ufshcd_transfer_req_compl(hba, (1UL << tag));
spin_unlock_irqrestore(host->host_lock, flags);
out:
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v10 0/9] Fix up and simplify error recovery mechanism
@ 2020-08-06 5:06 Can Guo
2020-08-06 5:06 ` Can Guo
0 siblings, 1 reply; 17+ messages in thread
From: Can Guo @ 2020-08-06 5:06 UTC (permalink / raw)
To: asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
saravanak, salyzyn, cang
The changes have been tested with error injections of multiple error types (and
all kinds of mixture of them) during runtime, e.g. hibern8 enter/ exit error,
power mode change error and fatal/non-fatal error from IRQ context. During the
test, error injections happen randomly across all contexts, e.g. clk scaling,
clk gate/ungate, runtime suspend/resume and IRQ.
There are a few more fixes to resolve other minor problems based on the main
change, such as LINERESET handling and racing btw error handler and system
suspend/resume/shutdown, but they will be pushed after this series is taken,
due to there are already too many lines in these changes.
Change since v9:
- Fixed compilation warning from option [-Werror=implicit-fallthrough=] in patch "scsi: ufs: Fix a racing problem btw error handler and runtime PM ops"
Change since v8:
- Added one more fix to ufshcd_abort as requested by Stanley Chu
Change since v7:
- Incorporated Asutosh's comments
- Refined patch "scsi: ufs: Recover hba runtime PM error in error handler"
Change since v6:
- Modified change "scsi: ufs-qcom: Fix schedule while atomic error in ufs_qcom_dump_dbg_regs" to "scsi: ufs-qcom: Remove testbus dump in ufs_qcom_dump_dbg_regs"
Change since v5:
- Dropped change "scsi: ufs: Fix imbalanced scsi_block_reqs_cnt caused by ufshcd_hold()" as it is not quite related with this series
- Refined func ufshcd_err_handling_prepare in change "scsi: ufs: Recover hba runtime PM error in error handler"
Change since v4:
- Split the original change "ufs: ufs-qcom: Fix a few BUGs in func ufs_qcom_dump_dbg_regs()" to 2 small changes
Change since v3:
- Split the original change "scsi: ufs: Fix up and simplify error recovery mechanism" into 5 changes
Change since v2:
- Incorporate Bart's comment to change "scsi: ufs: Add checks before setting clk-gating states"
- Revised the commit msg of change "scsi: ufs: Fix up and simplify error recovery mechanism"
Change since v1:
- Fixed a compilation error in case that CONFIG_PM is N
Can Guo (9):
scsi: ufs: Add checks before setting clk-gating states
ufs: ufs-qcom: Fix race conditions caused by func
ufs_qcom_testbus_config
scsi: ufs-qcom: Remove testbus dump in ufs_qcom_dump_dbg_regs
scsi: ufs: Add some debug infos to ufshcd_print_host_state
scsi: ufs: Fix concurrency of error handler and other error recovery
paths
scsi: ufs: Recover hba runtime PM error in error handler
scsi: ufs: Move dumps in IRQ handler to error handler
scsi: ufs: Fix a racing problem btw error handler and runtime PM ops
scsi: ufs: Properly release resources if a task is aborted
successfully
drivers/scsi/ufs/ufs-qcom.c | 37 ----
drivers/scsi/ufs/ufs-sysfs.c | 1 +
drivers/scsi/ufs/ufshcd.c | 509 +++++++++++++++++++++++++++----------------
drivers/scsi/ufs/ufshcd.h | 14 ++
4 files changed, 339 insertions(+), 222 deletions(-)
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully
2020-08-06 5:06 [PATCH v10 0/9] Fix up and simplify error recovery mechanism Can Guo
2020-08-06 5:06 ` Can Guo
@ 2020-08-06 5:06 ` Can Guo
0 siblings, 0 replies; 17+ messages in thread
From: Can Guo @ 2020-08-06 5:06 UTC (permalink / raw)
To: asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
saravanak, salyzyn, cang
Cc: Bart Van Assche, Martin K. Petersen, James E.J. Bottomley,
open list, Avri Altman, moderated list:ARM/Mediatek SoC support,
Alim Akhtar, Matthias Brugger, Stanley Chu,
moderated list:ARM/Mediatek SoC support, Bean Huo
In current UFS task abort hook, namely ufshcd_abort(), if a task is
aborted successfully, clock scaling busy time statistics is not updated
and, most important, clk_gating.active_reqs is not decreased, which makes
clk_gating.active_reqs stay above zero forever, thus clock gating would
never happen. To fix it, instead of releasing resources "mannually", use
the existing func __ufshcd_transfer_req_compl(). This can also eliminate
racing of scsi_dma_unmap() from the real completion in IRQ handler path.
Signed-off-by: Can Guo <cang@codeaurora.org>
CC: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index b2947ab..9541fc7 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6636,11 +6636,8 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
goto out;
}
- scsi_dma_unmap(cmd);
-
spin_lock_irqsave(host->host_lock, flags);
- ufshcd_outstanding_req_clear(hba, tag);
- hba->lrb[tag].cmd = NULL;
+ __ufshcd_transfer_req_compl(hba, (1UL << tag));
spin_unlock_irqrestore(host->host_lock, flags);
out:
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully
@ 2020-08-06 5:06 ` Can Guo
0 siblings, 0 replies; 17+ messages in thread
From: Can Guo @ 2020-08-06 5:06 UTC (permalink / raw)
To: asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
saravanak, salyzyn, cang
Cc: Bart Van Assche, Martin K. Petersen, James E.J. Bottomley,
open list, Avri Altman, moderated list:ARM/Mediatek SoC support,
Alim Akhtar, Matthias Brugger, Stanley Chu,
moderated list:ARM/Mediatek SoC support, Bean Huo
In current UFS task abort hook, namely ufshcd_abort(), if a task is
aborted successfully, clock scaling busy time statistics is not updated
and, most important, clk_gating.active_reqs is not decreased, which makes
clk_gating.active_reqs stay above zero forever, thus clock gating would
never happen. To fix it, instead of releasing resources "mannually", use
the existing func __ufshcd_transfer_req_compl(). This can also eliminate
racing of scsi_dma_unmap() from the real completion in IRQ handler path.
Signed-off-by: Can Guo <cang@codeaurora.org>
CC: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index b2947ab..9541fc7 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6636,11 +6636,8 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
goto out;
}
- scsi_dma_unmap(cmd);
-
spin_lock_irqsave(host->host_lock, flags);
- ufshcd_outstanding_req_clear(hba, tag);
- hba->lrb[tag].cmd = NULL;
+ __ufshcd_transfer_req_compl(hba, (1UL << tag));
spin_unlock_irqrestore(host->host_lock, flags);
out:
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully
@ 2020-08-06 5:06 ` Can Guo
0 siblings, 0 replies; 17+ messages in thread
From: Can Guo @ 2020-08-06 5:06 UTC (permalink / raw)
To: asutoshd, nguyenb, hongwus, rnayak, linux-scsi, kernel-team,
saravanak, salyzyn, cang
Cc: Stanley Chu, Alim Akhtar, Avri Altman, James E.J. Bottomley,
Martin K. Petersen, Matthias Brugger, Bean Huo, Bart Van Assche,
open list, moderated list:ARM/Mediatek SoC support,
moderated list:ARM/Mediatek SoC support
In current UFS task abort hook, namely ufshcd_abort(), if a task is
aborted successfully, clock scaling busy time statistics is not updated
and, most important, clk_gating.active_reqs is not decreased, which makes
clk_gating.active_reqs stay above zero forever, thus clock gating would
never happen. To fix it, instead of releasing resources "mannually", use
the existing func __ufshcd_transfer_req_compl(). This can also eliminate
racing of scsi_dma_unmap() from the real completion in IRQ handler path.
Signed-off-by: Can Guo <cang@codeaurora.org>
CC: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index b2947ab..9541fc7 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6636,11 +6636,8 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
goto out;
}
- scsi_dma_unmap(cmd);
-
spin_lock_irqsave(host->host_lock, flags);
- ufshcd_outstanding_req_clear(hba, tag);
- hba->lrb[tag].cmd = NULL;
+ __ufshcd_transfer_req_compl(hba, (1UL << tag));
spin_unlock_irqrestore(host->host_lock, flags);
out:
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
^ permalink raw reply related [flat|nested] 17+ messages in thread
end of thread, other threads:[~2020-08-10 0:50 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-07 9:33 [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully Markus Elfring
2020-08-07 13:01 ` Can Guo
2020-08-07 13:01 ` Can Guo
2020-08-07 13:01 ` Can Guo
2020-08-07 13:01 ` Can Guo
2020-08-09 18:00 ` [9/9] " Markus Elfring
2020-08-09 18:00 ` Markus Elfring
2020-08-10 0:48 ` Can Guo
2020-08-10 0:48 ` Can Guo
2020-08-10 0:48 ` Can Guo
2020-08-10 0:48 ` Can Guo
-- strict thread matches above, loose matches on Subject: below --
2020-08-09 12:15 [PATCH v11 0/9] Fix up and simplify error recovery mechanism Can Guo
2020-08-09 12:15 ` [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully Can Guo
2020-08-09 12:15 ` Can Guo
2020-08-09 12:15 ` Can Guo
2020-08-06 5:06 [PATCH v10 0/9] Fix up and simplify error recovery mechanism Can Guo
2020-08-06 5:06 ` [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully Can Guo
2020-08-06 5:06 ` Can Guo
2020-08-06 5:06 ` Can Guo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.