]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: ufs: core: Narrow down fast path in system suspend path
authorCan Guo <cang@codeaurora.org>
Mon, 26 Apr 2021 03:48:40 +0000 (20:48 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 29 Apr 2021 03:15:18 +0000 (23:15 -0400)
commitc41035e33747f58e9d2170809a0d90013ed07dfb
tree523db6cfaa6cc77d8e91de675f68b2d853cb91bc
parent39bfa6b723f85833f1bd0563a043b3ca61fca96d
scsi: ufs: core: Narrow down fast path in system suspend path

If spm_lvl is set to 0 or 1, when system suspend kicks start and HBA is
runtime active, system suspend may just bail without doing anything (the
fast path), leaving other contexts still running, e.g., clock gating and
clock scaling. When system resume kicks start, concurrency can happen
between ufshcd_resume() and these contexts, leading to various stability
issues.

Add a check against HBA's runtime state and allowing fast path only if HBA
is runtime suspended, otherwise let system suspend go ahead call
ufshcd_suspend(). This will guarantee that these contexts are stopped by
either runtime suspend or system suspend.

Link: https://lore.kernel.org/r/1619408921-30426-4-git-send-email-cang@codeaurora.org
Fixes: e38f0125a817 ("scsi: ufs: optimize system suspend handling")
Reviewed-by: Daejun Park <daejun7.park@samsung.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c