mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] scsi: ufs: fix exception event handling
@ 2018-01-29  4:34 Asutosh Das
  2018-02-08 17:53 ` Subhash Jadavani
  0 siblings, 1 reply; 2+ messages in thread
From: Asutosh Das @ 2018-01-29  4:34 UTC (permalink / raw)
  To: subhashj, cang, vivek.gautam, vinholikatti, jejb, martin.petersen
  Cc: linux-scsi, Maya Erez, Asutosh Das, open list

From: Maya Erez <merez@codeaurora.org>

The device can set the exception event bit in one of the response UPIU,
for example to notify the need for urgent BKOPs operation.
In such a case the host driver calls ufshcd_exception_event_handler to
handle this notification.
When trying to check the exception event status (for finding the cause for
the exception event), the device may be busy with additional SCSI commands
handling and may not respond within the 100ms timeout.

To prevent that, we need to block SCSI commands during handling of
exception events and allow retransmissions of the query requests,
in case of timeout.

Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
---
 drivers/scsi/ufs/ufshcd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 8af2af3..2dd488f 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4955,6 +4955,7 @@ static void ufshcd_exception_event_handler(struct work_struct *work)
 	hba = container_of(work, struct ufs_hba, eeh_work);
 
 	pm_runtime_get_sync(hba->dev);
+	scsi_block_requests(hba->host);
 	err = ufshcd_get_ee_status(hba, &status);
 	if (err) {
 		dev_err(hba->dev, "%s: failed to get exception status %d\n",
@@ -4968,6 +4969,7 @@ static void ufshcd_exception_event_handler(struct work_struct *work)
 		ufshcd_bkops_exception_event_handler(hba);
 
 out:
+	scsi_unblock_requests(hba->host);
 	pm_runtime_put_sync(hba->dev);
 	return;
 }
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.

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

* Re: [PATCH 1/1] scsi: ufs: fix exception event handling
  2018-01-29  4:34 [PATCH 1/1] scsi: ufs: fix exception event handling Asutosh Das
@ 2018-02-08 17:53 ` Subhash Jadavani
  0 siblings, 0 replies; 2+ messages in thread
From: Subhash Jadavani @ 2018-02-08 17:53 UTC (permalink / raw)
  To: Asutosh Das
  Cc: cang, vivek.gautam, vinholikatti, jejb, martin.petersen,
	linux-scsi, Maya Erez, linux-kernel, linux-scsi-owner

On 2018-01-28 20:34, Asutosh Das wrote:
> From: Maya Erez <merez@codeaurora.org>
> 
> The device can set the exception event bit in one of the response UPIU,
> for example to notify the need for urgent BKOPs operation.
> In such a case the host driver calls ufshcd_exception_event_handler to
> handle this notification.
> When trying to check the exception event status (for finding the cause 
> for
> the exception event), the device may be busy with additional SCSI 
> commands
> handling and may not respond within the 100ms timeout.
> 
> To prevent that, we need to block SCSI commands during handling of
> exception events and allow retransmissions of the query requests,
> in case of timeout.
> 
> Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
> Signed-off-by: Maya Erez <merez@codeaurora.org>
> Signed-off-by: Can Guo <cang@codeaurora.org>
> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
> ---
>  drivers/scsi/ufs/ufshcd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 8af2af3..2dd488f 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -4955,6 +4955,7 @@ static void
> ufshcd_exception_event_handler(struct work_struct *work)
>  	hba = container_of(work, struct ufs_hba, eeh_work);
> 
>  	pm_runtime_get_sync(hba->dev);
> +	scsi_block_requests(hba->host);
>  	err = ufshcd_get_ee_status(hba, &status);
>  	if (err) {
>  		dev_err(hba->dev, "%s: failed to get exception status %d\n",
> @@ -4968,6 +4969,7 @@ static void
> ufshcd_exception_event_handler(struct work_struct *work)
>  		ufshcd_bkops_exception_event_handler(hba);
> 
>  out:
> +	scsi_unblock_requests(hba->host);
>  	pm_runtime_put_sync(hba->dev);
>  	return;
>  }

Looks good to me.
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

end of thread, other threads:[~2018-02-08 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-29  4:34 [PATCH 1/1] scsi: ufs: fix exception event handling Asutosh Das
2018-02-08 17:53 ` Subhash Jadavani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome