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-changelog

[Xen-changelog] [xen-unstable] More getcpuinfo sysctl cleanup.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] More getcpuinfo sysctl cleanup.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 27 Jun 2007 18:02:48 -0700
Delivery-date: Wed, 27 Jun 2007 18:01:09 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1182977023 -3600
# Node ID 3362de397f1e78d43edc0888d4500b4ae21b7af4
# Parent  806dc0aca7475fafc79824e8366274ef1efb5051
More getcpuinfo sysctl cleanup.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/libxc/xc_misc.c       |   41 +++++++++++++++++++++++------------------
 tools/libxc/xenctrl.h       |    4 +++-
 xen/common/sysctl.c         |   14 +++++++-------
 xen/include/public/sysctl.h |   27 +++++++++++++++------------
 4 files changed, 48 insertions(+), 38 deletions(-)

diff -r 806dc0aca747 -r 3362de397f1e tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c     Wed Jun 27 21:28:19 2007 +0100
+++ b/tools/libxc/xc_misc.c     Wed Jun 27 21:43:43 2007 +0100
@@ -101,30 +101,35 @@ int xc_perfc_control(int xc_handle,
 
     rc = do_sysctl(xc_handle, &sysctl);
 
-    if (nbr_desc)
+    if ( nbr_desc )
         *nbr_desc = sysctl.u.perfc_op.nr_counters;
-    if (nbr_val)
+    if ( nbr_val )
         *nbr_val = sysctl.u.perfc_op.nr_vals;
 
     return rc;
 }
 
-int xc_cpuinfo(int xc_handle, int max_cpus, uint64_t *info, int *nr_cpus)
-{
-    int ret;
-    DECLARE_SYSCTL;
-
-    sysctl.cmd = XEN_SYSCTL_cpuinfo;
-    sysctl.u.cpuinfo.max_cpus = max_cpus; 
-    set_xen_guest_handle(sysctl.u.cpuinfo.buffer, info); 
-
-    if ( (ret = do_sysctl(xc_handle, &sysctl)) != 0 )
-        return ret;
-
-    if(nr_cpus) 
-        *nr_cpus = sysctl.u.cpuinfo.nr_cpus; 
-
-    return 0;
+int xc_getcpuinfo(int xc_handle, int max_cpus,
+                  xc_cpuinfo_t *info, int *nr_cpus)
+{
+    int rc;
+    DECLARE_SYSCTL;
+
+    sysctl.cmd = XEN_SYSCTL_getcpuinfo;
+    sysctl.u.getcpuinfo.max_cpus = max_cpus; 
+    set_xen_guest_handle(sysctl.u.getcpuinfo.info, info); 
+
+    if ( (rc = lock_pages(info, max_cpus*sizeof(*info))) != 0 )
+        return rc;
+
+    rc = do_sysctl(xc_handle, &sysctl);
+
+    unlock_pages(info, max_cpus*sizeof(*info));
+
+    if ( nr_cpus )
+        *nr_cpus = sysctl.u.getcpuinfo.nr_cpus; 
+
+    return rc;
 }
 
 
diff -r 806dc0aca747 -r 3362de397f1e tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Wed Jun 27 21:28:19 2007 +0100
+++ b/tools/libxc/xenctrl.h     Wed Jun 27 21:43:43 2007 +0100
@@ -479,7 +479,9 @@ int xc_sched_id(int xc_handle,
 int xc_sched_id(int xc_handle,
                 int *sched_id);
 
-int xc_cpuinfo(int xc_handle, int max_cpus, uint64_t *info, int *nr_cpus); 
+typedef xen_sysctl_cpuinfo_t xc_cpuinfo_t;
+int xc_getcpuinfo(int xc_handle, int max_cpus,
+                  xc_cpuinfo_t *info, int *nr_cpus); 
 
 int xc_domain_setmaxmem(int xc_handle,
                         uint32_t domid,
diff -r 806dc0aca747 -r 3362de397f1e xen/common/sysctl.c
--- a/xen/common/sysctl.c       Wed Jun 27 21:28:19 2007 +0100
+++ b/xen/common/sysctl.c       Wed Jun 27 21:43:43 2007 +0100
@@ -136,13 +136,13 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
     }
     break;
 
-    case XEN_SYSCTL_cpuinfo:
+    case XEN_SYSCTL_getcpuinfo:
     {
         uint32_t i, nr_cpus;
-        uint64_t idletime;
+        struct xen_sysctl_cpuinfo cpuinfo;
         struct vcpu *v;
 
-        nr_cpus = min_t(uint32_t, op->u.cpuinfo.max_cpus, NR_CPUS);
+        nr_cpus = min_t(uint32_t, op->u.getcpuinfo.max_cpus, NR_CPUS);
 
         for ( i = 0; i < nr_cpus; i++ )
         {
@@ -150,18 +150,18 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
             if ( (v = idle_vcpu[i]) == NULL )
                 break;
 
-            idletime = v->runstate.time[RUNSTATE_running];
+            cpuinfo.idletime = v->runstate.time[RUNSTATE_running];
             if ( v->is_running )
-                idletime += NOW() - v->runstate.state_entry_time;
+                cpuinfo.idletime += NOW() - v->runstate.state_entry_time;
 
-            if ( copy_to_guest_offset(op->u.cpuinfo.buffer, i, &idletime, 1) )
+            if ( copy_to_guest_offset(op->u.getcpuinfo.info, i, &cpuinfo, 1) )
             {
                 ret = -EFAULT;
                 break;
             }
         }
 
-        op->u.cpuinfo.nr_cpus = i;
+        op->u.getcpuinfo.nr_cpus = i;
         ret = 0;
 
         if ( copy_to_guest(u_sysctl, op, 1) )
diff -r 806dc0aca747 -r 3362de397f1e xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h       Wed Jun 27 21:28:19 2007 +0100
+++ b/xen/include/public/sysctl.h       Wed Jun 27 21:43:43 2007 +0100
@@ -140,9 +140,7 @@ typedef struct xen_sysctl_getdomaininfol
 typedef struct xen_sysctl_getdomaininfolist xen_sysctl_getdomaininfolist_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getdomaininfolist_t);
 
-/*
- * Inject debug keys into Xen.
- */
+/* Inject debug keys into Xen. */
 #define XEN_SYSCTL_debug_keys        7
 struct xen_sysctl_debug_keys {
     /* IN variables. */
@@ -152,17 +150,22 @@ typedef struct xen_sysctl_debug_keys xen
 typedef struct xen_sysctl_debug_keys xen_sysctl_debug_keys_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_debug_keys_t);
 
-/* Get physical CPU information */
-#define XEN_SYSCTL_cpuinfo           8
+/* Get physical CPU information. */
+#define XEN_SYSCTL_getcpuinfo        8
 struct xen_sysctl_cpuinfo {
-    /* IN variables. */
-    uint32_t                      max_cpus;
-    XEN_GUEST_HANDLE_64(uint64_t) buffer;
-    /* OUT variables. */
-    uint32_t                      nr_cpus;
-}; 
+    uint64_t idletime;
+};
 typedef struct xen_sysctl_cpuinfo xen_sysctl_cpuinfo_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpuinfo_t); 
+struct xen_sysctl_getcpuinfo {
+    /* IN variables. */
+    uint32_t max_cpus;
+    XEN_GUEST_HANDLE_64(xen_sysctl_cpuinfo_t) info;
+    /* OUT variables. */
+    uint32_t nr_cpus;
+}; 
+typedef struct xen_sysctl_getcpuinfo xen_sysctl_getcpuinfo_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getcpuinfo_t); 
 
 struct xen_sysctl {
     uint32_t cmd;
@@ -175,7 +178,7 @@ struct xen_sysctl {
         struct xen_sysctl_perfc_op          perfc_op;
         struct xen_sysctl_getdomaininfolist getdomaininfolist;
         struct xen_sysctl_debug_keys        debug_keys;
-        struct xen_sysctl_cpuinfo           cpuinfo;
+        struct xen_sysctl_getcpuinfo        getcpuinfo;
         uint8_t                             pad[128];
     } u;
 };

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] More getcpuinfo sysctl cleanup., Xen patchbot-unstable <=