Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit a24461d3 authored by Can Guo's avatar Can Guo
Browse files

scsi: ufs: Fix some racing problems in ufshcd_shutdown()



Currently I/O requests could be still submitted to UFS device while
UFS is working on shutdown flow. This may lead to racing as below
scenarios and finally system may crash due to unclocked register
accesses.

To fix this kind of issues, in ufshcd_shutdown(),

1. Use pm_runtime_get_sync() instead of resuming UFS device by
   ufshcd_runtime_resume() "internally" to let runtime PM framework
   manage and prevent concurrent runtime operations by incoming I/O
   requests.

2. Specifically quiesce the SCSI device of UFS Device well known LU
   so that ufshcd_suspend() can still send the SSU cmd, and remove
   all the other SCSI devices to block all I/O requests to those
   SCSI devices.

Example of racing scenario: While UFS device is runtime-suspended

Thread #1: Executing UFS shutdown flow, e.g.,
           ufshcd_suspend(UFS_SHUTDOWN_PM)

Thread #2: Executing runtime resume flow triggered by I/O request,
           e.g., ufshcd_resume(UFS_RUNTIME_PM)

This breaks the assumption that UFS PM flows can not be running
concurrently and some unexpected racing behavior may happen.

Change-Id: I83345e6b48a832ec7962fc016f4fdf128c9a5bd1
Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
parent 0e2097ce
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment