x86: add hypercall to query current underlying pCPU's frequency
PATCH 1/1 x86: add hypercall to query current underlying pCPU's frequency
xen/arch/x86/platform_hypercall.c +16 -2
@@ -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(xebreak ; }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 ;
xen/arch/x86/x86_64/platform_hypercall.c +2 -0
@@ -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
xen/include/public/platform.h +11 -0
@@ -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; };
I still consider this not a useful or informative operation.
-- Keir
Quoted 108 lines · Jan Beulich
Signed-off-by Jan Beulich <[email protected]>Index:
2008-09-19/xen/arch/x86/platform_hypercall.c
===================================================================
---2008-09-19.orig/xen/arch/x86/platform_hypercall.c2008-09-19 14:12:02.000000000 +0200
+++2008-09-19/xen/arch/x86/platform_hypercall.c2008-09-19 14:12:56.000000000 +0200xen/arch/x86/platform_hypercall.c +16
-2@@ -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(xebreak ; }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.c2008-09-19 14:12:02.000000000 +0200
+++2008-09-19/xen/arch/x86/x86_64/platform_hypercall.c2008-09-19 13:59:35.000000000 +0200xen/arch/x86/x86_64/platform_hypercall.c +2
-0@@ -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.h2008-09-19 14:12:02.000000000 +0200
+++2008-09-19/xen/include/public/platform.h2008-09-19 13:59:35.000000000 +0200xen/include/public/platform.h +11
-0@@ -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
[email protected]
http://lists.xensource.com/xen-devel
Guanqun will make out a simple dom0 utility to the list by utilizing sysctl this week. maybe call it 'lspm'.
Thanks,
Kevin
Quoted 118 lines
From: Keir Fraser
Sent: 2008年9月20日 16:34I still consider this not a useful or informative operation.
-- Keir
Quoted 7 lines · Jan Beulich
Signed-off-by Jan Beulich <[email protected]>Index:
2008-09-19/xen/arch/x86/platform_hypercall.c
===================================================================
---2008-09-19.orig/xen/arch/x86/platform_hypercall.c2008-09-19 14:12:02.000000000 +0200
+++2008-09-19/xen/arch/x86/platform_hypercall.c2008-09-1914:12:56.000000000
Quoted 32 lines
+0200
xen/arch/x86/platform_hypercall.c +4
-2@@ -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(xebreak ; }break ; + +case XENPF_get_cpu_freq:xen/arch/x86/platform_hypercall.c ret_t do_platform_op(XEN_GUEST_HANDLE(xe · line 496
Quoted 10 lines
xen/arch/x86/platform_hypercall.c +10
-0+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) )
Quoted 8 lines
xen/arch/x86/platform_hypercall.c +2
-0+ 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.c2008-09-19
Quoted 12 lines
14:12:02.000000000 +0200
+++2008-09-19/xen/arch/x86/x86_64/platform_hypercall.c2008-09-19 13:59:35.000000000 +0200xen/arch/x86/x86_64/platform_hypercall.c +2
-0@@ -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 Quoted 5 lines
Index:
2008-09-19/xen/include/public/platform.h
===================================================================
---2008-09-19.orig/xen/include/public/platform.h2008-09-19 14:12:02.000000000 +0200
+++2008-09-19/xen/include/public/platform.h2008-09-1913:59:35.000000000
Review struct xenpf_set_processor_pminfo { · line 312
Quoted 3 lines
+0200
(quoted diff) +0
-0@@ -312,6 +312,16 @@ struct xenpf_set_processor_pminfo { typedef struct xenpf_set_processor_pminfo
xenpf_set_processor_pminfo_t;Quoted 27 lines
xen/include/public/platform.h +11
-0DEFINE_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; };
Quoted 12 lines
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
My guess is that Jan would like to export this via sysfs, and hence doesn't legitimately have access to domctl/sysctl. I don't agree with the overall motivation though. I prefer this 'lspm' utility and also integration with xentrace.
-- Keir
Quoted 136 lines · Kevin
Guanqun will make out a simple dom0 utility to the list by utilizing sysctl this week. maybe call it 'lspm'.
Thanks,
KevinQuoted 130 lines
From: Keir Fraser
Sent: 2008年9月20日 16:34I still consider this not a useful or informative operation.
-- Keir
Quoted 7 lines · Jan Beulich
Signed-off-by Jan Beulich <[email protected]>Index:
2008-09-19/xen/arch/x86/platform_hypercall.c
===================================================================
---2008-09-19.orig/xen/arch/x86/platform_hypercall.c2008-09-19 14:12:02.000000000 +0200
+++2008-09-19/xen/arch/x86/platform_hypercall.c2008-09-1914:12:56.000000000
Quoted 32 lines
+0200
xen/arch/x86/platform_hypercall.c +4
-2@@ -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(xebreak ; }break ; + +case XENPF_get_cpu_freq:xen/arch/x86/platform_hypercall.c ret_t do_platform_op(XEN_GUEST_HANDLE(xe · line 496
Quoted 10 lines
xen/arch/x86/platform_hypercall.c +10
-0+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) )
Quoted 8 lines
xen/arch/x86/platform_hypercall.c +2
-0+ 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.c2008-09-19
Quoted 12 lines
14:12:02.000000000 +0200
+++2008-09-19/xen/arch/x86/x86_64/platform_hypercall.c2008-09-19 13:59:35.000000000 +0200xen/arch/x86/x86_64/platform_hypercall.c +2
-0@@ -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 Quoted 5 lines
Index:
2008-09-19/xen/include/public/platform.h
===================================================================
---2008-09-19.orig/xen/include/public/platform.h2008-09-19 14:12:02.000000000 +0200
+++2008-09-19/xen/include/public/platform.h2008-09-1913:59:35.000000000
Review struct xenpf_set_processor_pminfo { · line 312
Quoted 3 lines
+0200
(quoted diff) +0
-0@@ -312,6 +312,16 @@ struct xenpf_set_processor_pminfo { typedef struct xenpf_set_processor_pminfo
xenpf_set_processor_pminfo_t;Quoted 27 lines
xen/include/public/platform.h +11
-0DEFINE_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; };Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
1st version would be a simple dump to hypercall content, with some proper calculations added. This at least gives people immediate chance for a summary. Later we'll then extend to xentrace.
Thanks,
Kevin
Quoted 74 lines
From: Keir Fraser [mailto:[email protected]]
Sent: 2008年9月22日 15:05My guess is that Jan would like to export this via sysfs, and hence doesn't
legitimately have access to domctl/sysctl. I don't agree with the overall
motivation though. I prefer this 'lspm' utility and also integration with
xentrace.-- Keir
Quoted 23 lines · Kevin
Guanqun will make out a simple dom0 utility to the list by utilizing sysctl this week. maybe call it 'lspm'.
Thanks,
KevinQuoted 17 lines
From: Keir Fraser
Sent: 2008年9月20日 16:34I still consider this not a useful or informative operation.
-- Keir
Quoted 7 lines · Jan Beulich
Signed-off-by Jan Beulich <[email protected]>Index:
2008-09-19/xen/arch/x86/platform_hypercall.c
===================================================================
---2008-09-19.orig/xen/arch/x86/platform_hypercall.c2008-09-19 14:12:02.000000000 +0200
+++2008-09-19/xen/arch/x86/platform_hypercall.c2008-09-1914:12:56.000000000
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
+0200
xen/arch/x86/platform_hypercall.c +0
-0@@ -21,7 +21,7 @@#include <xen/acpi.h> #include <asm/current.h> Quoted 8 lines
xen/arch/x86/platform_hypercall.c static long cpu_frequency_change_helper( · line 55
Quoted 8 lines
xen/arch/x86/platform_hypercall.c +1
-1#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)Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
xen/arch/x86/platform_hypercall.c +1
-1{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;Quoted 8 lines
Quoted 8 lines
xen/arch/x86/platform_hypercall.c ret_t do_platform_op(XEN_GUEST_HANDLE(xe · line 488
Quoted 8 lines
xen/arch/x86/platform_hypercall.c +4
-0@@ -482,6 +482,20 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xebreak ; }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]) )
Quoted 83 lines
Quoted 6 lines
Quoted 6 lines
xen/arch/x86/platform_hypercall.c ret_t do_platform_op(XEN_GUEST_HANDLE(xe
Quoted 6 lines
xen/arch/x86/platform_hypercall.c +6
-0+ { + ret = -EINVAL ; +break ; + } + + op->u.get_cpu_freq.freq =cpufreq_cpu_policy[v->processor] ?
Quoted 73 lines
Quoted 73 lines
Review ret_t do_platform_op(XEN_GUEST_HANDLE(xe · line 496
Quoted 2 lines
(quoted diff) +2
-0+ cpufreq_cpu_policy[v->processor]->cur : 0; + if ( copy_field_to_guest(u_xenpf_op, op,u.get_cpu_freq.freq) )
Quoted 8 lines
xen/arch/x86/platform_hypercall.c +2
-0+ 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.c2008-09-19
Quoted 12 lines
14:12:02.000000000 +0200
+++2008-09-19/xen/arch/x86/x86_64/platform_hypercall.c2008-09-19 13:59:35.000000000 +0200xen/arch/x86/x86_64/platform_hypercall.c +2
-0@@ -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 Quoted 5 lines
Index:
2008-09-19/xen/include/public/platform.h
===================================================================
---2008-09-19.orig/xen/include/public/platform.h2008-09-19 14:12:02.000000000 +0200
+++2008-09-19/xen/include/public/platform.h2008-09-1913:59:35.000000000
Review struct xenpf_set_processor_pminfo { · line 312
Quoted 3 lines
+0200
(quoted diff) +0
-0@@ -312,6 +312,16 @@ struct xenpf_set_processor_pminfo { typedef struct xenpf_set_processor_pminfo
xenpf_set_processor_pminfo_t;Quoted 27 lines
xen/include/public/platform.h +11
-0DEFINE_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; };Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Re: [PATCH] x86: add hypercall to query currentunderlying pCPU's frequency
In reply to Keir FraserOkay, 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
Quoted 1 line
Quoted 1 line
Quoted 1 line
Keir Fraser <[email protected]> 20.09.08 10:34 >>>
I still consider this not a useful or informative operation.
-- Keir
Quoted 108 lines · Jan Beulich
Signed-off-by Jan Beulich <[email protected]>Index:
2008-09-19/xen/arch/x86/platform_hypercall.c
===================================================================
---2008-09-19.orig/xen/arch/x86/platform_hypercall.c2008-09-19 14:12:02.000000000 +0200
+++2008-09-19/xen/arch/x86/platform_hypercall.c2008-09-19 14:12:56.000000000 +0200xen/arch/x86/platform_hypercall.c +16
-2@@ -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(xebreak ; }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.c2008-09-19 14:12:02.000000000 +0200
+++2008-09-19/xen/arch/x86/x86_64/platform_hypercall.c2008-09-19 13:59:35.000000000 +0200xen/arch/x86/x86_64/platform_hypercall.c +2
-0@@ -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.h2008-09-19 14:12:02.000000000 +0200
+++2008-09-19/xen/include/public/platform.h2008-09-19 13:59:35.000000000 +0200xen/include/public/platform.h +11
-0@@ -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
[email protected]
http://lists.xensource.com/xen-devel
Re: [PATCH] x86: add hypercall to query currentunderlying pCPU's frequency
Well, I'm not personally against this, if used sensibly, but it sounds the sort of thing the Advisory Board would have to be asked about, since it could be considered to promote forking of the hypervisor interfaces.
-- Keir
Quoted 14 lines · Jan Beulich
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.
Re: [PATCH] x86: add hypercall to querycurrentunderlying pCPU's frequency
What/who is the Advisory Board, and how would I forward the question to it/them? Jan
Quoted 1 line
Quoted 1 line
Quoted 1 line
Keir Fraser <[email protected]> 22.09.08 10:47 >>>
Well, I'm not personally against this, if used sensibly, but it sounds the sort of thing the Advisory Board would have to be asked about, since it could be considered to promote forking of the hypervisor interfaces.
-- Keir
Quoted 14 lines · Jan Beulich
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.
Re: [PATCH] x86: add hypercall to querycurrentunderlying pCPU's frequency
There's a paragraph at:
http://www.xen.org/community/
Since the AB is involved in managing the Xen trademark, and this would be a decision which is part of defining what Xen is, I think the decision rests with them.
Their address is xen-advisory-board at same list server as xen-devel. Also Novell is a member: I think the contact is Holger Dyroff.
-- Keir
Quoted 29 lines · Jan Beulich
What/who is the Advisory Board, and how would I forward the question to it/them? Jan
Quoted 1 line
Quoted 1 line
Quoted 1 line
Keir Fraser <[email protected]> 22.09.08 10:47 >>>
Well, I'm not personally against this, if used sensibly, but it sounds the sort of thing the Advisory Board would have to be asked about, since it could be considered to promote forking of the hypervisor interfaces.
-- Keir
Quoted 14 lines · Jan Beulich
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.