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] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jW+ivsWjMgwaQKmhNxxz2wByYuLQL7i-hRamjH2We+8g@mail.gmail.com>
Date: Fri, 25 Apr 2025 18:30:35 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, 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 V2 1/5] cpufreq: acpi: Re-sync CPU boost state on system resume

On Thu, Apr 24, 2025 at 6:20 PM Viresh Kumar <viresh.kumar@...aro.org> wrote:
>
> During CPU hotunplug events (such as those occurring during
> suspend/resume cycles), platform firmware may modify the CPU boost
> state.
>
> If boost was disabled prior to CPU removal, it correctly remains
> disabled upon re-plug. However, if firmware re-enables boost while the
> CPU is offline, the CPU may return with boost enabled—even if it was
> originally disabled—once it is hotplugged back in. This leads to
> inconsistent behavior and violates user or kernel policy expectations.
>
> To maintain consistency, ensure the boost state is re-synchronized with
> the kernel policy when a CPU is hotplugged back in.
>
> Note: This re-synchronization is not necessary during the initial call
> to ->init() for a CPU, as the cpufreq core handles it via
> cpufreq_online(). At that point, acpi_cpufreq_driver.boost_enabled is
> initialized to the value returned by boost_state(0).
>
> 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
> Tested-by: Nicholas Chin <nic.c3.14@...il.com>
> Reviewed-by: Lifeng Zheng <zhenglifeng1@...wei.com>
> Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>

I gather that this patch is for 6.15 and the rest of the series is for
6.16, so applied accordingly.

> ---
>  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 924314cdeebc..d26b610e4f24 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -909,8 +909,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;
> +               }
> +       }
>
>         return result;
>
> --
> 2.31.1.272.g89b43f80a514
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ