[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: Add sysctl for cpu online/offline



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1222096024 -3600
# Node ID 0c8d2e44126d2562dbc71732889051076728034b
# Parent  415c3da25b26296335a3c6cf0511957f48dfd601
x86: Add sysctl for cpu online/offline

Signed-off-by:  Shan Haitao <haitao.shan@xxxxxxxxx>
---
 xen/arch/x86/sysctl.c       |   25 +++++++++++++++++++++++++
 xen/include/public/sysctl.h |   13 +++++++++++++
 2 files changed, 38 insertions(+)

diff -r 415c3da25b26 -r 0c8d2e44126d xen/arch/x86/sysctl.c
--- a/xen/arch/x86/sysctl.c     Mon Sep 22 15:56:12 2008 +0100
+++ b/xen/arch/x86/sysctl.c     Mon Sep 22 16:07:04 2008 +0100
@@ -28,6 +28,12 @@
 #include <xsm/xsm.h>
 
 #define get_xen_guest_handle(val, hnd)  do { val = (hnd).p; } while (0)
+
+static long cpu_down_helper(void *data)
+{
+    int cpu = (unsigned long)data;
+    return cpu_down(cpu);
+}
 
 long arch_do_sysctl(
     struct xen_sysctl *sysctl, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
@@ -92,6 +98,25 @@ long arch_do_sysctl(
     }
     break;
     
+    case XEN_SYSCTL_cpu_hotplug:
+    {
+        unsigned int cpu = sysctl->u.cpu_hotplug.cpu;
+
+        switch ( sysctl->u.cpu_hotplug.op )
+        {
+        case XEN_SYSCTL_CPU_HOTPLUG_ONLINE:
+            ret = cpu_up(cpu);
+            break;
+        case XEN_SYSCTL_CPU_HOTPLUG_OFFLINE:
+            ret = continue_hypercall_on_cpu(
+                0, cpu_down_helper, (void *)(unsigned long)cpu);
+            break;
+        default:
+            ret = -EINVAL;
+            break;
+        }
+    }
+    break;
 
     default:
         ret = -ENOSYS;
diff -r 415c3da25b26 -r 0c8d2e44126d xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h       Mon Sep 22 15:56:12 2008 +0100
+++ b/xen/include/public/sysctl.h       Mon Sep 22 16:07:04 2008 +0100
@@ -262,6 +262,18 @@ typedef struct xen_sysctl_get_pmstat xen
 typedef struct xen_sysctl_get_pmstat xen_sysctl_get_pmstat_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_get_pmstat_t);
 
+#define XEN_SYSCTL_cpu_hotplug       11
+struct xen_sysctl_cpu_hotplug {
+    /* IN variables */
+    uint32_t cpu;   /* Physical cpu. */
+#define XEN_SYSCTL_CPU_HOTPLUG_ONLINE  0
+#define XEN_SYSCTL_CPU_HOTPLUG_OFFLINE 1
+    uint32_t op;    /* hotplug opcode */
+};
+typedef struct xen_sysctl_cpu_hotplug xen_sysctl_cpu_hotplug_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpu_hotplug_t);
+
+
 struct xen_sysctl {
     uint32_t cmd;
     uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
@@ -276,6 +288,7 @@ struct xen_sysctl {
         struct xen_sysctl_getcpuinfo        getcpuinfo;
         struct xen_sysctl_availheap         availheap;
         struct xen_sysctl_get_pmstat        get_pmstat;
+        struct xen_sysctl_cpu_hotplug       cpu_hotplug;
         uint8_t                             pad[128];
     } u;
 };

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.