All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] Deliver cpufreq actual average freq to libxc interface
@ 2009-03-20  2:47 Liu, Jinsong
  0 siblings, 0 replies; only message in thread
From: Liu, Jinsong @ 2009-03-20  2:47 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

Deliver cpufreq actual average freq to libxc interface

Calculate cpu actual average freq according to aperf and mperf MSR and then deliver to libxc interface

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>

[-- Attachment #2: px-xen-2-libxc.patch --]
[-- Type: application/octet-stream, Size: 3169 bytes --]

Deliver cpufreq actual average freq to libxc interface

Calculate cpu actual average freq according to aperf and mperf MSR and then deliver to libxc interface

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>

diff -r a8454fa4e4c1 tools/libxc/xc_pm.c
--- a/tools/libxc/xc_pm.c	Thu Mar 19 21:23:52 2009 +0800
+++ b/tools/libxc/xc_pm.c	Thu Mar 19 21:50:09 2009 +0800
@@ -307,6 +307,24 @@ int xc_set_cpufreq_para(int xc_handle, i
     return xc_sysctl(xc_handle, &sysctl);
 }
 
+int xc_get_cpufreq_avgfreq(int xc_handle, int cpuid, int *avg_freq)
+{
+    int ret = 0;
+    DECLARE_SYSCTL;
+
+    if ( (xc_handle < 0) || (!avg_freq) )
+        return -EINVAL;
+
+    sysctl.cmd = XEN_SYSCTL_pm_op;
+    sysctl.u.pm_op.cmd = GET_CPUFREQ_AVGFREQ;
+    sysctl.u.pm_op.cpuid = cpuid;
+    ret = xc_sysctl(xc_handle, &sysctl);
+
+    *avg_freq = sysctl.u.pm_op.get_avgfreq;
+
+    return ret;
+}
+
 int xc_get_cputopo(int xc_handle, struct xc_get_cputopo *info)
 {
     int rc;
diff -r a8454fa4e4c1 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Thu Mar 19 21:23:52 2009 +0800
+++ b/tools/libxc/xenctrl.h	Thu Mar 19 21:50:09 2009 +0800
@@ -1242,6 +1242,7 @@ int xc_set_cpufreq_gov(int xc_handle, in
 int xc_set_cpufreq_gov(int xc_handle, int cpuid, char *govname);
 int xc_set_cpufreq_para(int xc_handle, int cpuid,
                         int ctrl_type, int ctrl_value);
+int xc_get_cpufreq_avgfreq(int xc_handle, int cpuid, int *avg_freq);
 
 struct xc_get_cputopo {
      /* IN: maximum addressable entry in
diff -r a8454fa4e4c1 xen/drivers/acpi/pmstat.c
--- a/xen/drivers/acpi/pmstat.c	Thu Mar 19 21:23:52 2009 +0800
+++ b/xen/drivers/acpi/pmstat.c	Thu Mar 19 21:50:10 2009 +0800
@@ -416,6 +416,16 @@ static int set_cpufreq_para(struct xen_s
     return ret;
 }
 
+static int get_cpufreq_avgfreq(struct xen_sysctl_pm_op *op)
+{
+    if ( !op || !cpu_online(op->cpuid) )
+        return -EINVAL;
+
+    op->get_avgfreq = cpufreq_driver_getavg(op->cpuid, USR_GETAVG);
+
+    return 0;
+}
+
 static int get_cputopo (struct xen_sysctl_pm_op *op)
 {
     uint32_t i, nr_cpus;
@@ -501,6 +511,12 @@ int do_pm_op(struct xen_sysctl_pm_op *op
         break;
     }
 
+    case GET_CPUFREQ_AVGFREQ:
+    {
+        ret = get_cpufreq_avgfreq(op);
+        break;
+    }
+
     case XEN_SYSCTL_pm_op_get_cputopo:
     {
         ret = get_cputopo(op);
diff -r a8454fa4e4c1 xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h	Thu Mar 19 21:23:52 2009 +0800
+++ b/xen/include/public/sysctl.h	Thu Mar 19 21:50:10 2009 +0800
@@ -367,6 +367,7 @@ struct xen_sysctl_pm_op {
     #define GET_CPUFREQ_PARA           (CPUFREQ_PARA | 0x01)
     #define SET_CPUFREQ_GOV            (CPUFREQ_PARA | 0x02)
     #define SET_CPUFREQ_PARA           (CPUFREQ_PARA | 0x03)
+    #define GET_CPUFREQ_AVGFREQ        (CPUFREQ_PARA | 0x04)
 
     /* get CPU topology */
     #define XEN_SYSCTL_pm_op_get_cputopo  0x20
@@ -377,6 +378,7 @@ struct xen_sysctl_pm_op {
         struct xen_get_cpufreq_para get_para;
         struct xen_set_cpufreq_gov  set_gov;
         struct xen_set_cpufreq_para set_para;
+        uint64_t get_avgfreq;
         struct xen_get_cputopo      get_topo;
     };
 };

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-20  2:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-20  2:47 [PATCH 2/3] Deliver cpufreq actual average freq to libxc interface Liu, Jinsong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.