Re: [PATCH 2/6] cpufreq: acpi: Re-sync CPU boost state on system resume

From: Rafael J. Wysocki
Date: Thu Apr 24 2025 - 07:27:38 EST


On Thu, Apr 24, 2025 at 9:27 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
>
> On 23-04-25, 16:59, Rafael J. Wysocki wrote:
> > On Wed, Apr 23, 2025 at 4:40 PM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
> > > > 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() ->
>
> Right.
>
> > > > 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.
>
> Sure.
>
> > I also think that acpi_cpufreq_resume() may be a better place for
> > re-syncing the boost state with policy->boost_enabled because it may
> > do that for CPU 0 as well as for the non-boot CPUs.
>
> I thought about that but kept this in acpi_cpufreq_cpu_init() as there
> are other corner cases too. A simple CPU hotplug (without
> suspend/resume) for example. In that case exit/init will get called
> but not resume.

Fair enough.