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][cpufreq] Xen support for the ondemand governor [1/2]

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH][cpufreq] Xen support for the ondemand governor [1/2] (hypervisor code)
From: "Mark Langsdorf" <mark.langsdorf@xxxxxxx>
Date: Tue, 23 Oct 2007 17:00:22 -0500
Delivery-date: Tue, 23 Oct 2007 14:58:07 -0700
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.5
Modify the cpufreq ondemand governor so that it can get idle and
total ticks from the Xen hypervisor.  Linux and Xen have different
ideas of what an idle tick is, so the Xen values for both have to
be returned in the same platform hypercall.

Signed-off-by: Mark Langsdorf <mark.langsdorf@xxxxxxx>

diff -r b4278beaf354 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Wed Oct 17 13:12:03 2007 +0100
+++ b/xen/arch/x86/platform_hypercall.c Thu Oct 18 16:07:53 2007 -0500
@@ -295,14 +295,17 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
     {
         uint32_t i, nr_cpus;
         uint64_t idletime;
+       uint64_t totaltime;
         struct vcpu *v;
         XEN_GUEST_HANDLE(uint64_t) idletimes;
+        XEN_GUEST_HANDLE(uint64_t) totaltimes;
 
         ret = -ENOSYS;
         if ( cpufreq_controller != FREQCTL_dom0_kernel )
             break;
 
         guest_from_compat_handle(idletimes, op->u.getidletime.idletime);
+        guest_from_compat_handle(totaltimes, op->u.getidletime.totaltime);
         nr_cpus = min_t(uint32_t, op->u.getidletime.max_cpus, NR_CPUS);
 
         for ( i = 0; i < nr_cpus; i++ )
@@ -312,11 +315,16 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
                 break;
 
             idletime = v->runstate.time[RUNSTATE_running];
+            totaltime = idletime + v->runstate.time[RUNSTATE_runnable] +
+                v->runstate.time[RUNSTATE_blocked] +
+                v->runstate.time[RUNSTATE_offline];
             if ( v->is_running )
                 idletime += NOW() - v->runstate.state_entry_time;
 
             ret = -EFAULT;
-            if ( copy_to_guest_offset(idletimes, i, &idletime, 1) )
+            if ( copy_to_guest_offset(idletimes, i, &idletime, 1) ) 
+                goto out;
+            if ( copy_to_guest_offset(totaltimes, i, &totaltime, 1) )
                 goto out;
         }
 
diff -r b4278beaf354 xen/include/public/platform.h
--- a/xen/include/public/platform.h     Wed Oct 17 13:12:03 2007 +0100
+++ b/xen/include/public/platform.h     Thu Oct 18 16:07:53 2007 -0500
@@ -179,6 +179,7 @@ struct xenpf_getidletime {
     /* IN variables. */
     uint32_t max_cpus;
     XEN_GUEST_HANDLE(uint64_t) idletime;
+    XEN_GUEST_HANDLE(uint64_t) totaltime;
     /* OUT variables. */
     uint32_t nr_cpus;
 };





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