From: Bart Van Assche <bvanassche@acm.org>
To: Stanley Chu <stanley.chu@mediatek.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
martin.petersen@oracle.com, avri.altman@wdc.com,
alim.akhtar@samsung.com, jejb@linux.ibm.com
Cc: peter.wang@mediatek.com, chun-hung.wu@mediatek.com,
alice.chao@mediatek.com, powen.kao@mediatek.com,
mason.zhang@mediatek.com, qilin.tan@mediatek.com,
lin.gui@mediatek.com, eddie.huang@mediatek.com,
tun-yu.yu@mediatek.com, cc.chou@mediatek.com,
chaotian.jing@mediatek.com, jiajie.hao@mediatek.com
Subject: Re: [PATCH v1] scsi: ufs: Fix ufshcd_scale_clks decision in recovery flow
Date: Fri, 29 Jul 2022 13:11:59 -0700 [thread overview]
Message-ID: <7e8c58cf-64c1-8426-bf22-97d3df85ed38@acm.org> (raw)
In-Reply-To: <20220729075519.4665-1-stanley.chu@mediatek.com>
On 7/29/22 00:55, Stanley Chu wrote:
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 581d88af07ab..dc57a7988023 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -1574,8 +1574,6 @@ static ssize_t ufshcd_clkscale_enable_store(struct device *dev,
> ufshcd_rpm_get_sync(hba);
> ufshcd_hold(hba, false);
>
> - hba->clk_scaling.is_enabled = value;
> -
> if (value) {
> ufshcd_resume_clkscaling(hba);
> } else {
> @@ -1586,6 +1584,8 @@ static ssize_t ufshcd_clkscale_enable_store(struct device *dev,
> __func__, err);
> }
>
> + hba->clk_scaling.is_enabled = value;
> +
> ufshcd_release(hba);
> ufshcd_rpm_put_sync(hba);
> out:
> @@ -7259,7 +7259,8 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba)
> hba->silence_err_logs = false;
>
> /* scale up clocks to max frequency before full reinitialization */
> - ufshcd_scale_clks(hba, true);
> + if (ufshcd_is_clkscaling_supported(hba) && hba->clk_scaling.is_enabled)
> + ufshcd_scale_clks(hba, true);
>
> err = ufshcd_hba_enable(hba);
I see a race condition between the hba->clk_scaling.is_enabled check in
ufshcd_host_reset_and_restore() and the code that sets
ufshcd_clkscale_enable_store(). Shouldn't the code in
ufshcd_host_reset_and_restore() that scales up the clocks be serialized
against ufshcd_clkscale_enable_store()?
Thanks,
Bart.
next prev parent reply other threads:[~2022-07-29 20:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-29 7:55 Stanley Chu
2022-07-29 20:11 ` Bart Van Assche [this message]
2022-07-30 7:08 ` Stanley Chu
2022-08-01 17:34 ` Bart Van Assche
2022-08-02 0:31 ` Stanley Chu
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=7e8c58cf-64c1-8426-bf22-97d3df85ed38@acm.org \
--to=bvanassche@acm.org \
--cc=alice.chao@mediatek.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=cc.chou@mediatek.com \
--cc=chaotian.jing@mediatek.com \
--cc=chun-hung.wu@mediatek.com \
--cc=eddie.huang@mediatek.com \
--cc=jejb@linux.ibm.com \
--cc=jiajie.hao@mediatek.com \
--cc=lin.gui@mediatek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mason.zhang@mediatek.com \
--cc=peter.wang@mediatek.com \
--cc=powen.kao@mediatek.com \
--cc=qilin.tan@mediatek.com \
--cc=stanley.chu@mediatek.com \
--cc=tun-yu.yu@mediatek.com \
/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
all inboxes | Powered by JetHome®