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: <CAJZ5v0jFy9ch4ZcW_zQs6GfvB=LCnzm94d35ifMpdv=VrqTHQA@mail.gmail.com>
Date: Wed, 23 Apr 2025 16:40:04 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: Lifeng Zheng <zhenglifeng1@...wei.com>, linux-pm@...r.kernel.org, 
	Vincent Guittot <vincent.guittot@...aro.org>, Nicholas Chin <nic.c3.14@...il.com>, 
	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/6] cpufreq: acpi: Re-sync CPU boost state on system resume

On Wed, Apr 23, 2025 at 4:26 PM Rafael J. Wysocki <rafael@...nel.org> wrote:
>
> On Tue, Apr 22, 2025 at 11:54 AM Viresh Kumar <viresh.kumar@...aro.org> wrote:
> >
> > During suspend/resume cycles, platform firmware may alter the CPU boost
> > state.
> >
> > If boost is disabled before suspend, it correctly remains off after
> > resume. However, if firmware re-enables boost during suspend, the system
> > may resume with boost frequencies enabled—even when the boost flag was
> > originally disabled. This violates expected behavior.
> >
> > Ensure the boost state is re-synchronized with the kernel policy during
> > system resume to maintain consistency.
> >
> > Fixes: 2b16c631832d ("cpufreq: ACPI: Remove set_boost in acpi_cpufreq_cpu_init()")
> > Reported-by: Nicholas Chin <nic.c3.14@...il.com>
> > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220013
> > Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
> > ---
> >  drivers/cpufreq/acpi-cpufreq.c | 15 +++++++++++++--
> >  1 file changed, 13 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> > index 7002e8de8098..0ffabf740ff5 100644
> > --- a/drivers/cpufreq/acpi-cpufreq.c
> > +++ b/drivers/cpufreq/acpi-cpufreq.c
> > @@ -893,8 +893,19 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
> >         if (perf->states[0].core_frequency * 1000 != freq_table[0].frequency)
> >                 pr_warn(FW_WARN "P-state 0 is not max freq\n");
> >
> > -       if (acpi_cpufreq_driver.set_boost)
> > -               policy->boost_supported = true;
> > +       if (acpi_cpufreq_driver.set_boost) {
> > +               if (policy->boost_supported) {
> > +                       /*
> > +                        * The firmware may have altered boost state while the
> > +                        * CPU was offline (for example during a suspend-resume
> > +                        * cycle).
> > +                        */
> > +                       if (policy->boost_enabled != boost_state(cpu))
> > +                               set_boost(policy, policy->boost_enabled);
> > +               } else {
> > +                       policy->boost_supported = true;
>
> IIUC policy->boost_enabled is false at this point, so say that
> boost_state(cpu) returns true and say cpufreq_boost_enabled() returns
> false.

This cannot happen for CPU 0 because of acpi_cpufreq_boost_init() ->

> cpufreq_online() will see policy->boost_enabled ==
> cpufreq_boost_enabled(), so it won't do anything regarding boost, and
> say that this happens for all online CPUs.

-> so if boost_state(0) returns true, policy->boost_enabled will be
set for all policies to start with due to the code in
cpufreq_online(), but this is far from obvious.

I would at least say in the changelog that set_boost() need not be
called directly at the policy initialization time because of the
above.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ