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] x86: add hypercall to query currentunderlying pC

To: "Keir Fraser" <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] x86: add hypercall to query currentunderlying pCPU's frequency
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Mon, 22 Sep 2008 08:55:47 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 22 Sep 2008 01:06:08 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C4FA7417.1D621%keir.fraser@xxxxxxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <48D3C0F9.76E4.0078.0@xxxxxxxxxx> <C4FA7417.1D621%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Okay, in that case I'll have to raise a general infra-structural question: If
I'm convinced I/we want something like this for ease of use and consistency
with the native kernel, how would I (generally) add (sub-)hypercalls to
our Xen flavors without risking to ever collide with upstream? I'd consider
something like using (reserving) the number space starting with e.g. ASCII
'NW' (a traditional Novell prefix) in the upper 16 bits, but of course I'd
want to have formal insurance that this range would actually remain
reserved forever within each (sub-)hypercall ranges (and whatever else
may use [pseudo-]enumerated values).

Another alternative would obviously be to simply once again use an
enumeration of interested parties, who would then have a certain number
range globally (across all other [pseudo-]enumerations) reserved for their
purposes, i.e. with the upper so-many bits set to that 'vendor' enumerator.

Jan

>>> Keir Fraser <keir.fraser@xxxxxxxxxxxxx> 20.09.08 10:34 >>>
I still consider this not a useful or informative operation.

 -- Keir

On 19/9/08 14:10, "Jan Beulich" <jbeulich@xxxxxxxxxx> wrote:

> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
> 
> Index: 2008-09-19/xen/arch/x86/platform_hypercall.c
> ===================================================================
> --- 2008-09-19.orig/xen/arch/x86/platform_hypercall.c 2008-09-19
> 14:12:02.000000000 +0200
> +++ 2008-09-19/xen/arch/x86/platform_hypercall.c 2008-09-19 14:12:56.000000000
> +0200
> @@ -21,7 +21,7 @@
>  #include <xen/acpi.h>
>  #include <asm/current.h>
>  #include <public/platform.h>
> -#include <acpi/cpufreq/processor_perf.h>
> +#include <acpi/cpufreq/cpufreq.h>
>  #include <asm/edd.h>
>  #include <asm/mtrr.h>
>  #include "cpu/mtrr/mtrr.h"
> @@ -55,6 +55,7 @@ static long cpu_frequency_change_helper(
>  ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
>  {
>      ret_t ret = 0;
> +    struct vcpu *v;
>      struct xen_platform_op curop, *op = &curop;
>  
>      if ( !IS_PRIV(current->domain) )
> @@ -312,7 +313,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
>      {
>          uint32_t cpu;
>          uint64_t idletime, now = NOW();
> -        struct vcpu *v;
>          struct xenctl_cpumap ctlmap;
>          cpumask_t cpumap;
>          XEN_GUEST_HANDLE(uint8) cpumap_bitmap;
> @@ -482,6 +482,20 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
>              break;
>          }
>          break;
> +
> +    case XENPF_get_cpu_freq:
> +        if ( op->u.get_cpu_freq.vcpu >= MAX_VIRT_CPUS ||
> +             !(v = current->domain->vcpu[op->u.get_cpu_freq.vcpu]) )
> +        {
> +            ret = -EINVAL;
> +            break;
> +        }
> +
> +        op->u.get_cpu_freq.freq = cpufreq_cpu_policy[v->processor] ?
> +            cpufreq_cpu_policy[v->processor]->cur : 0;
> +        if ( copy_field_to_guest(u_xenpf_op, op, u.get_cpu_freq.freq) )
> +            ret = -EFAULT;
> +        break;
>   
>      default:
>          ret = -ENOSYS;
> Index: 2008-09-19/xen/arch/x86/x86_64/platform_hypercall.c
> ===================================================================
> --- 2008-09-19.orig/xen/arch/x86/x86_64/platform_hypercall.c 2008-09-19
> 14:12:02.000000000 +0200
> +++ 2008-09-19/xen/arch/x86/x86_64/platform_hypercall.c 2008-09-19
> 13:59:35.000000000 +0200
> @@ -21,6 +21,8 @@ DEFINE_XEN_GUEST_HANDLE(compat_platform_
>  #define xen_processor_power_t   compat_processor_power_t
>  #define set_cx_pminfo           compat_set_cx_pminfo
>  
> +#define xenpf_get_cpu_freq      compat_pf_get_cpu_freq
> +
>  #define xenpf_enter_acpi_sleep compat_pf_enter_acpi_sleep
>  
>  #define COMPAT
> Index: 2008-09-19/xen/include/public/platform.h
> ===================================================================
> --- 2008-09-19.orig/xen/include/public/platform.h 2008-09-19
> 14:12:02.000000000 +0200
> +++ 2008-09-19/xen/include/public/platform.h 2008-09-19 13:59:35.000000000
> +0200
> @@ -312,6 +312,16 @@ struct xenpf_set_processor_pminfo {
>  typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t;
>  DEFINE_XEN_GUEST_HANDLE(xenpf_set_processor_pminfo_t);
>  
> +#define XENPF_get_cpu_freq        55
> +struct xenpf_get_cpu_freq {
> +    /* IN variables */
> +    uint32_t vcpu;
> +    /* OUT variables */
> +    uint32_t freq; /* in kHz */
> +};
> +typedef struct xenpf_get_cpu_freq xenpf_get_cpu_freq_t;
> +DEFINE_XEN_GUEST_HANDLE(xenpf_get_cpu_freq_t);
> +
>  struct xen_platform_op {
>      uint32_t cmd;
>      uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
> @@ -327,6 +337,7 @@ struct xen_platform_op {
>          struct xenpf_change_freq       change_freq;
>          struct xenpf_getidletime       getidletime;
>          struct xenpf_set_processor_pminfo set_pminfo;
> +        struct xenpf_get_cpu_freq      get_cpu_freq;
>          uint8_t                        pad[128];
>      } u;
>  };
> 
> 
> 
> 
> _______________________________________________
> 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