[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] automatically enable cpu frequency scaling


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Rik van Riel <riel@xxxxxxxxxx>
  • Date: Thu, 13 Dec 2007 14:58:40 -0500
  • Delivery-date: Thu, 13 Dec 2007 11:59:11 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

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 <riel@xxxxxxxxxx>

--- xen/arch/x86/domain_build.c.autofreq        2007-12-13 14:48:19.000000000 
-0500
+++ xen/arch/x86/domain_build.c 2007-12-13 14:53:23.000000000 -0500
@@ -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);
 
--- xen/common/schedule.c.autofreq      2007-12-13 14:45:13.000000000 -0500
+++ xen/common/schedule.c       2007-12-13 14:53:51.000000000 -0500
@@ -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);


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.