From: "Peter Wang (王信友)" <peter.wang@mediatek.com>
To: "beanhuo@micron.com" <beanhuo@micron.com>,
"avri.altman@wdc.com" <avri.altman@wdc.com>,
"neil.armstrong@linaro.org" <neil.armstrong@linaro.org>,
"quic_cang@quicinc.com" <quic_cang@quicinc.com>,
"quic_nguyenb@quicinc.com" <quic_nguyenb@quicinc.com>,
"quic_nitirawa@quicinc.com" <quic_nitirawa@quicinc.com>,
"bvanassche@acm.org" <bvanassche@acm.org>,
"quic_ziqichen@quicinc.com" <quic_ziqichen@quicinc.com>,
"luca.weiss@fairphone.com" <luca.weiss@fairphone.com>,
"konrad.dybcio@oss.qualcomm.com" <konrad.dybcio@oss.qualcomm.com>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
"quic_rampraka@quicinc.com" <quic_rampraka@quicinc.com>,
"junwoo80.lee@samsung.com" <junwoo80.lee@samsung.com>,
"mani@kernel.org" <mani@kernel.org>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"Tze-nan Wu (吳澤南)" <Tze-nan.Wu@mediatek.com>,
"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
"manivannan.sadhasivam@linaro.org"
<manivannan.sadhasivam@linaro.org>,
"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
"James.Bottomley@HansenPartnership.com"
<James.Bottomley@HansenPartnership.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4] scsi: ufs: core: Don't perform UFS clkscale if host asyn scan in progress
Date: Mon, 28 Jul 2025 06:34:38 +0000 [thread overview]
Message-ID: <10b41d77c287393d4f6e50e712c3713839cb6a8c.camel@mediatek.com> (raw)
In-Reply-To: <1989e794-6539-4875-9e87-518da0715083@acm.org>
On Fri, 2025-07-25 at 07:54 -0700, Bart Van Assche wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> On 7/25/25 2:13 AM, Peter Wang (王信友) wrote:
> > Could consider luns_avail instead mutex?
>
> That would be wrong. I think it is essential that scan_mutex is used
> in
> this patch. Additionally, the lock inversion is between devfreq->lock
> and (c->notifiers)->rwsem so it seems unlikely to me that Ziqi's
> patch
> is the patch that introduced the reported lock inversion.
>
> Bart.
Hi Bart,
This is a complex situation involving six locks, which may result in
a circular locking dependency.
Let me explain how a new circular locking dependency is formed:
CPU0: take &(c->notifiers)->rwsem#2, wait &devfreq->lock
CPU1: take &devfreq->lock, wait &shost->scan_mutex, <= Lock introduced
by this patch
CPU2: take &shost->scan_mutex, wait &q->sysfs_lock
CPU3: take &q->sysfs_lock, wait cpu_hotplug_lock
CPU4: take cpu_hotplug_lock, wait subsys mutex#2
CPU5: take subsys mutex#2, wait &(c->notifiers)->rwsem#2 <= Hold By
CPU0
ufshcd_add_lus triggers ufshcd_devfreq_init.
This means that clock scaling can be performed while scanning LUNs.
However, this patch adds another lock to prevent clock scaling
before the LUN scan is complete. This is a paradoxical situation.
If we cannnot do clock scaling before the LUN scan is complete,
then why we start clock scaling before it?
If we don’t put it in luns_avail (start clock scaling after LUNs
scan complete), do you have a better suggestion
for where to initialize clock scaling (ufshcd_devfreq_init)?
Thanks.
Peter
next prev parent reply other threads:[~2025-07-28 6:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-22 8:12 Ziqi Chen
2025-05-27 21:24 ` Bart Van Assche
2025-05-28 1:58 ` Martin K. Petersen
2025-06-03 2:35 ` Martin K. Petersen
2025-07-25 9:13 ` Peter Wang (王信友)
2025-07-25 14:54 ` Bart Van Assche
2025-07-28 6:34 ` Peter Wang (王信友) [this message]
2025-07-29 3:02 ` Ziqi Chen
2025-07-30 12:55 ` Peter Wang (王信友)
2025-07-30 15:37 ` Bart Van Assche
2025-07-30 15:42 ` Bart Van Assche
2025-07-30 15:50 ` Bart Van Assche
2025-08-04 7:54 ` Ziqi Chen
2025-08-04 9:41 ` Peter Wang (王信友)
2025-08-04 12:43 ` Peter Wang (王信友)
2025-08-05 6:03 ` Ziqi Chen
2025-08-05 7:39 ` Peter Wang (王信友)
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=10b41d77c287393d4f6e50e712c3713839cb6a8c.camel@mediatek.com \
--to=peter.wang@mediatek.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=Tze-nan.Wu@mediatek.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=junwoo80.lee@samsung.com \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=luca.weiss@fairphone.com \
--cc=mani@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=martin.petersen@oracle.com \
--cc=neil.armstrong@linaro.org \
--cc=quic_cang@quicinc.com \
--cc=quic_nguyenb@quicinc.com \
--cc=quic_nitirawa@quicinc.com \
--cc=quic_rampraka@quicinc.com \
--cc=quic_ziqichen@quicinc.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®