More specifically, here is what I meant. Build tested.
Allow dom0 to request idle stats by mask, which is required
by sw coordination model. Also NOW() is stamped for caller
to cal sample period.
Signed-off-by Kevin Tian <kevin.tian@xxxxxxxxx>
diff -r 17f3e4f7bbe6 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Mon Oct 22 17:44:07 2007 -0400
+++ b/xen/arch/x86/platform_hypercall.c Tue Oct 23 16:53:43 2007 -0400
@@ -293,19 +293,23 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
case XENPF_getidletime:
{
- uint32_t i, nr_cpus;
+ uint32_t i;
uint64_t idletime;
struct vcpu *v;
+ struct xenctl_cpumap ctlmap;
+ cpumask_t cpumap;
XEN_GUEST_HANDLE(uint64_t) idletimes;
ret = -ENOSYS;
if ( cpufreq_controller != FREQCTL_dom0_kernel )
break;
+ ctlmap.nr_cpus = op->u.getidletime.nr_cpus;
+ guest_from_compat_handle(ctlmap.bitmap, op->u.getidletime.bitmap);
+ xenctl_cpumap_to_cpumask(&cpumap, &ctlmap);
guest_from_compat_handle(idletimes, op->u.getidletime.idletime);
- nr_cpus = min_t(uint32_t, op->u.getidletime.max_cpus, NR_CPUS);
-
- for ( i = 0; i < nr_cpus; i++ )
+
+ for_each_cpu_mask(i, cpumap)
{
/* Assume no holes in idle-vcpu map. */
if ( (v = idle_vcpu[i]) == NULL )
@@ -318,9 +322,12 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
ret = -EFAULT;
if ( copy_to_guest_offset(idletimes, i, &idletime, 1) )
goto out;
- }
-
- op->u.getidletime.nr_cpus = i;
+
+ cpu_clear(i, cpumap);
+ }
+
+ op->u.getidletime.now = NOW();
+ cpumask_to_xenctl_cpumap(&ctlmap, &cpumap);
ret = copy_to_guest(u_xenpf_op, op, 1) ? -EFAULT : 0;
}
break;
diff -r 17f3e4f7bbe6 xen/include/public/platform.h
--- a/xen/include/public/platform.h Mon Oct 22 17:44:07 2007 -0400
+++ b/xen/include/public/platform.h Tue Oct 23 16:12:22 2007 -0400
@@ -176,11 +176,12 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_change_fre
#define XENPF_getidletime 53
struct xenpf_getidletime {
- /* IN variables. */
- uint32_t max_cpus;
+ /* IN variables */
+ XEN_GUEST_HANDLE(uint8_t) bitmap;
+ uint32_t nr_cpus;
XEN_GUEST_HANDLE(uint64_t) idletime;
- /* OUT variables. */
- uint32_t nr_cpus;
+ /* OUT variables */
+ uint64_t now;
};
typedef struct xenpf_getidletime xenpf_getidletime_t;
DEFINE_XEN_GUEST_HANDLE(xenpf_getidletime_t);
>From: Tian, Kevin
>Sent: 2007年10月24日 11:08
>To: Mark Langsdorf; xen-devel@xxxxxxxxxxxxxxxxxxx
>Subject: RE: [Xen-devel] [PATCH][cpufreq] Xen support for the
>ondemandgovernor [1/2] (hypervisor code)
>
>>From: Mark Langsdorf
>>Sent: 2007年10月24日 6:00
>>
>>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>
>
>I would suggest adding bit mask info into getidletime, and then only
>fetching idle stats of concerned cpus. Currently [0-max_cpus] is
>overkill when on-demand governor only takes care of one cpu (hw
>coordination) or sibling cores (sw coordination).
>
>Also there's no need to return total time for each concerned cpu. For
>sw coordination model, on-demand governor only runs on one cpu
>and getidletime is only called on that agent cpu which takes care of
>all the rest idle stats. Naturally elapsed cycles since last sample point
>should be same on all affected cpus and it's useless to cal for them
>individually. You just need to stamp NOW() for the sample point.
>
>Thanks,
>Kevin
>
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@xxxxxxxxxxxxxxxxxxx
>http://lists.xensource.com/xen-devel
getidletime_mask.patch
Description: getidletime_mask.patch
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|