WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] automatically enable cpu frequency scaling
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
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Red Hat, Inc
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] automatically enable cpu frequency scaling, Rik van Riel <=