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

Skip to content
Commit 7ee6127e authored by Nitin Rawat's avatar Nitin Rawat
Browse files

scsi: ufs: fix race b/w resume and err_handler



In some rare scenario, race condition is observed between
eh_work handler and ufshcd_resume operation.
Sequence of events:

1. SSU command is send as a part of ufshcd_resume.
2. As a part of Auto Hibern8 Enter failure, err_handler
   scccessfully runs and recovers dev state as active and
   uic link as active.
3. In ufshcd_resume, after ssu return failure,
   it moved the link state as hibern8 and disabled the
   interrupt leaving dev state as active and link state
   as hibernate.
4. Later h8 exit is sent as a part of clk scaling but since
   interrupt is disabled uic command timeout happended.

Also when start stop failed runtime_error was set to
8000002 and since runtime error is only cleared
at initialization in the normal case, device can't resume
and watch dog expired happended .

scsi 0:0:0:49488: START_STOP failed for power mode: 1, result 8000002

Fix this by checking the device state and link state after
ssu returned failure using below conditions:

1. If current dev and link state is active, dont return error
as dev and link state is in correct state and hence proceed
with the resume.

2.If current dev and link state is not active but
err_handler is in progress wait on err handler to
get finished and proceed with the resume.

3. If current device and link state is not active and
err_handler is not in progress as well, then
abort the resume process and move back the
device to suspend state.

Change-Id: Ie03fd3b4b7163aed1fc9a6c4dd793ed010617fb6
Signed-off-by: default avatarNitin Rawat <nitirawa@codeaurora.org>
parent 9fcb976e
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