automatically enable cpu frequency scaling
PATCH 1/1 automatically enable cpu frequency scaling
Automatically enable cpu frequency scaling, unless the user disables it with cpufreq=off or cpufreq=none on the xen commandline, or the number of VCPUs that dom0 has does not match the number of physical CPUs in the system.
Signed-off-by Rik van Riel <[email protected]>
arch/x86/domain_build.c renamed from arch/x86/domain_build.c.autofreq +10 -0
@@ -780,6 +780,16 @@ int __init construct_dom0( opt_dom0_max_vcpus =BITS_PER_GUEST_LONG (d);printk ("Dom0 has maximum %u VCPUs\n" , opt_dom0_max_vcpus); +/* +* If dom0 has fewer VCPUs than there are physical CPUs on the system, +* we need to disable cpu frequency scaling. +*/ +if ( opt_dom0_max_vcpus !=num_online_cpus () ) { +extern unsigned int opt_dom0_vcpus_pin; + cpufreq_controller = FREQCTL_none; + opt_dom0_vcpus_pin =0 ; + } +for ( i =1 ; i < opt_dom0_max_vcpus; i++ ) (void )alloc_vcpu (d, i, i);
common/schedule.c renamed from common/schedule.c.autofreq +5 -2
@@ -38,16 +38,19 @@ static char opt_sched[10] = "credit";string_param ("sched" , opt_sched);/* opt_dom0_vcpus_pin: If true, dom0 VCPUs are pinned. */ -static unsigned int opt_dom0_vcpus_pin; +unsigned int opt_dom0_vcpus_pin =1 ;boolean_param ("dom0_vcpus_pin" , opt_dom0_vcpus_pin); -enum cpufreq_controller cpufreq_controller; +enum cpufreq_controller cpufreq_controller = FREQCTL_dom0_kernel;static void __init setup_cpufreq_option (char *str) {if ( !strcmp (str,"dom0-kernel" ) ) { cpufreq_controller = FREQCTL_dom0_kernel; opt_dom0_vcpus_pin =1 ; + }else if ( !strcmp (str,"off" ) || !strcmp (str,"none" ) ) { + cpufreq_controller = FREQCTL_none; + opt_dom0_vcpus_pin =0 ; } }custom_param ("cpufreq" , setup_cpufreq_option);