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

Re: [Xen-devel] [PATCH][cpufreq] Xen support for the ondemand governor [

To: Mark Langsdorf <mark.langsdorf@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH][cpufreq] Xen support for the ondemand governor [1/2] (hypervisor code)
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Wed, 24 Oct 2007 08:04:27 +0100
Delivery-date: Wed, 24 Oct 2007 00:00:03 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <200710231700.22795.mark.langsdorf@xxxxxxx>
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
Thread-index: AcgWDB15XAW5MIH/EdyyOQAWy6hiGQ==
Thread-topic: [Xen-devel] [PATCH][cpufreq] Xen support for the ondemand governor [1/2] (hypervisor code)
User-agent: Microsoft-Entourage/11.3.6.070618
You can already work out total 'ticks' (actually nanoseconds since boot) via
data stored in shared_info. There's code in arch/i386/kernel/time-xen.c to
do so. Use that rather than modify this hypercall.

 -- Keir

On 23/10/07 23:00, "Mark Langsdorf" <mark.langsdorf@xxxxxxx> wrote:

> 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



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