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
|