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]
Date: Fri, 2 Feb 2024 10:05:05 +0100
From: Beata Michalska <beata.michalska@....com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-pm@...r.kernel.org, sumitg@...dia.com, sudeep.holla@....covm,
	will@...nel.org, catalin.marinas@....com, viresh.kumar@...aro.org,
	ionela.voinescu@....com, yang@...amperecomputing.com,
	linux-tegra@...r.kernel.org
Subject: Re: [PATCH v2 2/2] cpufreq: Wire-up arch-flavored freq info into
 cpufreq_verify_current_freq

Apologies for extremely late reply, juggling too many things at time ....

On Wed, Dec 06, 2023 at 09:41:05PM +0100, Rafael J. Wysocki wrote:
> On Mon, Nov 27, 2023 at 5:09 PM Beata Michalska <beata.michalska@....com> wrote:
> >
> > From: Sumit Gupta <sumitg@...dia.com>
> >
> > When available, use arch_freq_get_on_cpu to obtain current frequency
> > (usually an average reported over given period of time)
> > to better align the cpufreq's view on the current state of affairs.
> 
> And why is this a good idea?
Apart from being problematic with an issue pointed at [1] (which will result
in dropping the change in cpufreq) this was to keep the cpufreq core aware of
potential frequency changes and take appropriate action (informing the governor)
case it got out of sync.
> 
> Any problem statement?
The problem has been raised here [2]
> 
> > This also automatically pulls in the update for cpuinfo_cur_freq sysfs
> > attribute, aligning it with the scaling_cur_freq one, and thus providing
> > consistent view on relevant platforms.
> 
> I have no idea what the above is supposed to mean, sorry.
Bad wording I guess. With this change both 'cpuinfo_cur_freq' and
'scaling_cur_freq' will use the arch_freq_get_on_cpu if available, and will use
the same source of information (one depending on a platform).

> 
> > Signed-off-by: Sumit Gupta <sumitg@...dia.com>
> > [BM: Subject & commit msg]
> > Signed-off-by: Beata Michalska <beata.michalska@....com>
> > ---
> >  drivers/cpufreq/cpufreq.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > index 8c4f9c2f9c44..109559438f45 100644
> > --- a/drivers/cpufreq/cpufreq.c
> > +++ b/drivers/cpufreq/cpufreq.c
> > @@ -1756,7 +1756,8 @@ static unsigned int cpufreq_verify_current_freq(struct cpufreq_policy *policy, b
> >  {
> >         unsigned int new_freq;
> >
> > -       new_freq = cpufreq_driver->get(policy->cpu);
> > +       new_freq = arch_freq_get_on_cpu(policy->cpu);
> > +       new_freq = new_freq ?: cpufreq_driver->get(policy->cpu);
> 
> Please don't use ?: in general and it is not even useful here AFAICS.
> 
> What would be wrong with
> 
> new_freq = arch_freq_get_on_cpu(policy->cpu);
> if (!new_freq)
>         new_freq = cpufreq_driver->get(policy->cpu);
> 
> ?
Nothing wrong with that.

---
[1] https://lore.kernel.org/all/ZWXy0h%2FfFfQh+Rhy@arm.com/
[2] https://lore.kernel.org/lkml/6a5710f6-bfbb-5dfd-11cd-0cd02220cee7@nvidia.com/
---
BR
Beata
> 
> >         if (!new_freq)
> >                 return 0;
> >
> > --

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ