lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e1c2c12bace22d1803d16ecbfb32129518d87157.camel@mediatek.com>
Date: Mon, 24 Mar 2025 03:21:05 +0000
From: Chun-Jen Tseng (曾俊仁)
	<Chun-Jen.Tseng@...iatek.com>
To: "viresh.kumar@...aro.org" <viresh.kumar@...aro.org>
CC: "cw00.choi@...sung.com" <cw00.choi@...sung.com>, "rafael@...nel.org"
	<rafael@...nel.org>, Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@...iatek.com>, "AngeloGioacchino Del
 Regno" <angelogioacchino.delregno@...labora.com>, "myungjoo.ham@...sung.com"
	<myungjoo.ham@...sung.com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "kyungmin.park@...sung.com"
	<kyungmin.park@...sung.com>, "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "matthias.bgg@...il.com"
	<matthias.bgg@...il.com>, "linux-pm@...r.kernel.org"
	<linux-pm@...r.kernel.org>, "linux-mediatek@...ts.infradead.org"
	<linux-mediatek@...ts.infradead.org>
Subject: Re: [PATCH v3 1/3] cpufreq: mediatek: using global lock avoid race
 condition

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ