cpufreq: ACPI: Defer setting boost MSRs
authorStuart Hayes <stuart.w.hayes@gmail.com>
Wed, 2 Nov 2022 19:59:57 +0000 (14:59 -0500)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 3 Nov 2022 18:18:53 +0000 (19:18 +0100)
commit13fdbc8b8da6a2325cad3359c9a70504b0ff2f93
tree1ec29f520424675346160bd3fcd59f414de4c66d
parent2842e06f19b94145238c76f0beb7b3b93943467c
cpufreq: ACPI: Defer setting boost MSRs

When acpi-cpufreq is loaded, boost is enabled on every CPU (by setting an
MSR) before the driver is registered with cpufreq.  This can be very time
consuming, because it is done with a CPU hotplug startup callback, and
cpuhp_setup_state() schedules the callback (cpufreq_boost_online()) to run
on each CPU one at a time, waiting for each to run before calling the next.

If cpufreq_register_driver() fails--if, for example, there are no ACPI
P-states present--this is wasted time.

Since cpufreq already sets up a CPU hotplug startup callback if and when
acpi-cpufreq is registered, set the boost MSRs in acpi_cpufreq_cpu_init(),
which is called by the cpufreq cpuhp callback.  This allows acpi-cpufreq to
exit quickly if it is loaded but not needed.

On one system with 192 CPUs, this patch speeds up boot by about 30 seconds.

Signed-off-by: Stuart Hayes <stuart.w.hayes@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/acpi-cpufreq.c