linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] scsi: ufs: fix broken hba->outstanding_tasks
@ 2019-07-24  5:50 Stanley Chu
  2019-07-24  5:50 ` [PATCH v2 1/3] scsi: ufs: clean-up task resource immediately only if task is responded Stanley Chu
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Stanley Chu @ 2019-07-24  5:50 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar,
	pedrom.sousa
  Cc: marc.w.gonzalez, andy.teng, chun-hung.wu, kuohong.wang, evgreen,
	linux-mediatek, peter.wang, matthias.bgg, Stanley Chu,
	linux-arm-kernel, beanhuo

Currently bits in hba->outstanding_tasks are cleared only after their
corresponding task management commands are successfully done by
__ufshcd_issue_tm_cmd().

If timeout happens in a task management command, its corresponding
bit in hba->outstanding_tasks will not be cleared until next task
management command with the same tag used successfully finishes.

This is wrong and can lead to some issues, like power issue.
For example, ufshcd_release() and ufshcd_gate_work() will do nothing
if hba->outstanding_tasks is not zero even if both UFS host and devices
are actually idle.

Referring to error handling flow of hba->outstanding_reqs, all timed-out
bits will be cleared by
ufshcd_reset_and_restore() => ufshcd_transfer_req_compl()
after reset is done. Therefore similar handling for hba->outstanding_tasks
could be applied, for example, by
ufshcd_reset_and_restore() => ufshcd_tmc_handler().

This patch tries to "re-factor" cleanup jobs first, and then add fixed
flow to make the whole patch more readable.

Stanley Chu (3):
  scsi: ufs: clean-up task resource immediately only if task is
    responded
  scsi: ufs: introduce ufshcd_tm_cmd_compl() to refactor task cleanup
  scsi: ufs: fix broken hba->outstanding_tasks

 drivers/scsi/ufs/ufshcd.c | 41 ++++++++++++++++++++++++++++++++-------
 1 file changed, 34 insertions(+), 7 deletions(-)

-- 
2.18.0

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

end of thread, other threads:[~2019-08-19 13:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-24  5:50 [PATCH v2 0/3] scsi: ufs: fix broken hba->outstanding_tasks Stanley Chu
2019-07-24  5:50 ` [PATCH v2 1/3] scsi: ufs: clean-up task resource immediately only if task is responded Stanley Chu
2019-07-24  5:50 ` [PATCH v2 2/3] scsi: ufs: introduce ufshcd_tm_cmd_compl() to refactor task cleanup Stanley Chu
2019-07-24  5:50 ` [PATCH v2 3/3] scsi: ufs: fix broken hba->outstanding_tasks Stanley Chu
2019-07-25  7:54 ` [PATCH v2 0/3] " Avri Altman
2019-07-25  8:52   ` Stanley Chu
2019-08-19 13:38     ` Stanley Chu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).