From: Can Guo <cang@codeaurora.org>
To: asutoshd@codeaurora.org, nguyenb@codeaurora.org,
hongwus@codeaurora.org, ziqichen@codeaurora.org,
linux-scsi@vger.kernel.org, kernel-team@android.com,
cang@codeaurora.org
Cc: Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@wdc.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Stanley Chu <stanley.chu@mediatek.com>,
Bean Huo <beanhuo@micron.com>, Jaegeuk Kim <jaegeuk@kernel.org>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v1 5/6] scsi: ufs: Let host_sem cover the entire system suspend/resume
Date: Wed, 12 May 2021 22:55:18 -0700 [thread overview]
Message-ID: <1620885319-15151-7-git-send-email-cang@codeaurora.org> (raw)
In-Reply-To: <1620885319-15151-1-git-send-email-cang@codeaurora.org>
UFS error handling now is doing more than just re-probing, but also sending
scsi cmds, e.g., for clearing UACs, and recovering runtime PM error, which
may change runtime status of scsi devices. To protect system suspend/resume
from being disturbed by error handling, move the host_sem from wl pm ops
to ufshcd_suspend_prepare() and ufshcd_resume_complete().
Signed-off-by: Can Guo <cang@codeaurora.org>
---
drivers/scsi/ufs/ufshcd.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 631c5f8..a6313cf40 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -8991,16 +8991,13 @@ static int ufshcd_wl_suspend(struct device *dev)
ktime_t start = ktime_get();
hba = shost_priv(sdev->host);
- down(&hba->host_sem);
if (pm_runtime_suspended(dev))
goto out;
ret = __ufshcd_wl_suspend(hba, UFS_SYSTEM_PM);
- if (ret) {
+ if (ret)
dev_err(&sdev->sdev_gendev, "%s failed: %d\n", __func__, ret);
- up(&hba->host_sem);
- }
out:
if (!ret)
@@ -9033,7 +9030,6 @@ static int ufshcd_wl_resume(struct device *dev)
hba->curr_dev_pwr_mode, hba->uic_link_state);
if (!ret)
hba->is_wl_sys_suspended = false;
- up(&hba->host_sem);
return ret;
}
#endif
@@ -9600,6 +9596,7 @@ void ufshcd_resume_complete(struct device *dev)
ufshcd_rpmb_rpm_put(hba);
hba->rpmb_complete_put = false;
}
+ up(&hba->host_sem);
}
EXPORT_SYMBOL_GPL(ufshcd_resume_complete);
@@ -9626,6 +9623,7 @@ int ufshcd_suspend_prepare(struct device *dev)
ufshcd_rpmb_rpm_get_sync(hba);
hba->rpmb_complete_put = true;
}
+ down(&hba->host_sem);
return 0;
}
EXPORT_SYMBOL_GPL(ufshcd_suspend_prepare);
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
next prev parent reply other threads:[~2021-05-13 5:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1620885319-15151-1-git-send-email-cang@codeaurora.org>
2021-05-13 5:55 ` [PATCH v1 1/6] scsi: ufs: Differentiate status between hba pm ops and wl pm ops Can Guo
2021-05-13 5:55 ` [PATCH v1 1/6] scsi: ufs: Differentiate status of hba " Can Guo
2021-05-13 5:58 ` Can Guo
2021-05-13 5:55 ` [PATCH v1 2/6] scsi: ufs: Update the return value of supplier " Can Guo
2021-05-13 5:55 ` [PATCH v1 3/6] scsi: ufs: Simplify error handling preparation Can Guo
2021-05-13 5:55 ` [PATCH v1 4/6] scsi: ufs: Update ufshcd_recover_pm_error() Can Guo
2021-05-13 5:55 ` Can Guo [this message]
2021-05-14 3:55 ` [PATCH v1 5/6] scsi: ufs: Let host_sem cover the entire system suspend/resume Bart Van Assche
2021-05-17 3:22 ` Can Guo
2021-05-17 15:05 ` Bart Van Assche
2021-05-13 5:55 ` [PATCH v1 6/6] scsi: ufs: Update the fast abort path in ufshcd_abort() for PM requests Can Guo
2021-05-14 4:05 ` Bart Van Assche
2021-05-14 4:17 ` Can Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1620885319-15151-7-git-send-email-cang@codeaurora.org \
--to=cang@codeaurora.org \
--cc=alim.akhtar@samsung.com \
--cc=asutoshd@codeaurora.org \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=hongwus@codeaurora.org \
--cc=jaegeuk@kernel.org \
--cc=jejb@linux.ibm.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=nguyenb@codeaurora.org \
--cc=stanley.chu@mediatek.com \
--cc=ziqichen@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).