scsi: ufs: synchronize between rls handler and clock scaling
Fix race condition between rls handler thread and clock scaling thread when LINERESET indication is sent out from host controller. A known scenario is when clock scaling thread has put link to hibern8 after gear scaling down is done, if rls handler thread, scheduled because of LINERESET indication from controller, starts to run now to scale gear up (PWM to HS), it would fail as the link state is still in hibern8 state. This change fixes this race condition by using write semaphore to prevent rls handler thread and clock scaling thread getting chance to run simultaneously. Change-Id: Ia1731c921c42155cacb43029d56491ddffcf2ee2 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> Signed-off-by: Can Guo <cang@codeaurora.org>
This commit is contained in:
parent
33f0ce8ba8
commit
e44e3d4cee
1 changed files with 2 additions and 0 deletions
|
@ -6316,6 +6316,7 @@ static void ufshcd_rls_handler(struct work_struct *work)
|
|||
hba = container_of(work, struct ufs_hba, rls_work);
|
||||
pm_runtime_get_sync(hba->dev);
|
||||
ufshcd_scsi_block_requests(hba);
|
||||
down_write(&hba->lock);
|
||||
ret = ufshcd_wait_for_doorbell_clr(hba, U64_MAX);
|
||||
if (ret) {
|
||||
dev_err(hba->dev,
|
||||
|
@ -6349,6 +6350,7 @@ static void ufshcd_rls_handler(struct work_struct *work)
|
|||
hba->restore_needed = false;
|
||||
|
||||
out:
|
||||
up_write(&hba->lock);
|
||||
ufshcd_scsi_unblock_requests(hba);
|
||||
pm_runtime_put_sync(hba->dev);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue