On 03.12.2024 09:11, Penny Zheng wrote:
> --- a/xen/drivers/cpufreq/cpufreq.c
> +++ b/xen/drivers/cpufreq/cpufreq.c
> @@ -316,7 +316,13 @@ int cpufreq_add_cpu(unsigned int cpu)
> if (hw_all || (cpumask_weight(cpufreq_dom->map) ==
> perf->domain_info.num_processors)) {
> memcpy(&new_policy, policy, sizeof(struct cpufreq_policy));
> - policy->governor = NULL;
> +
> + /*
> + * Only when cpufreq_driver.target exists, we need to deliberately
> set old gov as NULL
> + * to trigger the according gov starting.
> + */
> + if ( cpufreq_driver.target )
> + policy->governor = NULL;
>
> cpufreq_cmdline_common_para(&new_policy);
Looking at __cpufreq_set_policy(), wouldn't the condition better check
.setpolicy being NULL?
Jan