From: "Chun-Jen Tseng (曾俊仁)" <Chun-Jen.Tseng@mediatek.com>
To: "viresh.kumar@linaro.org" <viresh.kumar@linaro.org>
Cc: "cw00.choi@samsung.com" <cw00.choi@samsung.com>,
"rafael@kernel.org" <rafael@kernel.org>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"myungjoo.ham@samsung.com" <myungjoo.ham@samsung.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kyungmin.park@samsung.com" <kyungmin.park@samsung.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>
Subject: Re: [PATCH v3 1/3] cpufreq: mediatek: using global lock avoid race condition
Date: Mon, 24 Mar 2025 03:21:05 +0000 [thread overview]
Message-ID: <e1c2c12bace22d1803d16ecbfb32129518d87157.camel@mediatek.com> (raw)
In-Reply-To: <20250321060148.adhxjexpnm4dkpnt@vireshk-i7>
Hi viresh,
I think the best configuration sequence is as follows:
cpufreq policy -> set frequency -> CCI governor get
CPUFREQ_POSTCHANGE NB -> choose CCI frequency -> set CCI frequency
However, in drivers/devfreq/governor_passive.c#L77,
get_target_freq_with_cpufreq() retrieves the current frequency of each
policy,
and it determines the CCI frequency based on the frequency of each
policy.
But if policy-0 and policy-6 enter simultaneously, the CCI governor
might get an incorrect frequency.
cpufreq policy-0 -> set frequency -> CCI governor get
CPUFREQ_POSTCHANGE NB -> choose CCI frequency -> set CCI frequency
=> during this time, the CCI governor gets policy-0 and policy-6, BUT
policy-6 may change frequency by cpufreq driver at the same time.
Therefore, I want to change it so that only one policy can perform the
set frequency action at a time to avoid CCI running at the wrong
frequency.
BRs,
Mark Tseng
On Fri, 2025-03-21 at 11:31 +0530, Viresh Kumar wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> On 21-03-25, 05:32, Chun-Jen Tseng (曾俊仁) wrote:
> > I add a global lock related to the CCI driver.
> >
> > This is because the CCI needs to obtain the frequencies of policy-0
> > and
> > policy-6 to determine its own frequency.
> >
> > If policy-0 and policy-6 are set simultaneously, it may cause the
> > CCI
> > to select the wrong frequency.
> >
> > Therefore, I hope to change the setting flow to the following:
> > policy-0 or policy-6 -> set frequency -> CCI receives
> > notification -
> > set CCI frequency
>
> Can you please point to the code where this race exists ? I am not
> sure I fully understand it as of now. If the race is present in
> another driver, CCI ?, then shouldn't it be fixed there instead ?
>
> --
> viresh
next prev parent reply other threads:[~2025-03-24 3:21 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 7:43 [PATCH v3 0/3] fixed mediatek-cpufreq has multi policy concurrency issue Mark Tseng
2025-02-14 7:43 ` [PATCH v3 1/3] cpufreq: mediatek: using global lock avoid race condition Mark Tseng
2025-02-19 5:42 ` Viresh Kumar
2025-03-20 8:22 ` Chun-Jen Tseng (曾俊仁)
2025-03-21 4:56 ` Viresh Kumar
2025-03-21 5:32 ` Chun-Jen Tseng (曾俊仁)
2025-03-21 6:01 ` Viresh Kumar
2025-03-24 3:21 ` Chun-Jen Tseng (曾俊仁) [this message]
2025-03-24 5:43 ` Viresh Kumar
2025-04-14 8:42 ` Chun-Jen Tseng (曾俊仁)
2025-04-16 8:05 ` Viresh Kumar
2025-08-28 13:26 ` Chen-Yu Tsai
2025-08-29 5:47 ` Viresh Kumar
2025-02-19 7:23 ` Dan Carpenter
2025-03-20 8:25 ` Chun-Jen Tseng (曾俊仁)
2025-02-14 7:43 ` [PATCH v3 2/3] cpufreq: mediatek: Add CPUFREQ_ASYNC_NOTIFICATION flag Mark Tseng
2025-02-19 5:45 ` Viresh Kumar
2025-03-20 8:34 ` Chun-Jen Tseng (曾俊仁)
2025-03-21 4:59 ` Viresh Kumar
2025-02-14 7:43 ` [PATCH v3 3/3] cpufreq: mediatek: data safety protect Mark Tseng
2025-02-19 5:49 ` Viresh Kumar
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=e1c2c12bace22d1803d16ecbfb32129518d87157.camel@mediatek.com \
--to=chun-jen.tseng@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=cw00.choi@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=myungjoo.ham@samsung.com \
--cc=rafael@kernel.org \
--cc=viresh.kumar@linaro.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
all inboxes | Powered by JetHome®