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

[Xen-changelog] [xen-unstable] Xen core parking 1: hypercall



# HG changeset patch
# User Liu, Jinsong <jinsong.liu@xxxxxxxxx>
# Date 1332515273 0
# Node ID f6a2fb739ad053202dc037c963e55b9c3895c26a
# Parent  b7a1794aed59fd2b0816b3bbcf97690c0241814f
Xen core parking 1: hypercall

This patch implement hypercall through which dom0 send core parking
request, and get core parking result.
Due to the characteristic of continue_hypercall_on_cpu, dom0
seperately send/get core parking request/result.

Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>
Committed-by: Keir Fraser <keir@xxxxxxx>
---


diff -r b7a1794aed59 -r f6a2fb739ad0 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Fri Mar 23 13:45:28 2012 +0000
+++ b/xen/arch/x86/platform_hypercall.c Fri Mar 23 15:07:53 2012 +0000
@@ -56,6 +56,10 @@
 long cpu_up_helper(void *data);
 long cpu_down_helper(void *data);
 
+/* from core_parking.c */
+long core_parking_helper(void *data);
+uint32_t get_cur_idle_nums(void);
+
 ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
 {
     ret_t ret = 0;
@@ -609,6 +613,32 @@
                       op->u.mem_add.epfn,
                       op->u.mem_add.pxm);
         break;
+
+    case XENPF_core_parking:
+    {
+        uint32_t idle_nums;
+
+        switch(op->u.core_parking.type)
+        {
+        case XEN_CORE_PARKING_SET:
+            idle_nums = min_t(uint32_t,
+                    op->u.core_parking.idle_nums, num_present_cpus() - 1);
+            ret = continue_hypercall_on_cpu(
+                    0, core_parking_helper, (void *)(unsigned long)idle_nums);
+            break;
+
+        case XEN_CORE_PARKING_GET:
+            op->u.core_parking.idle_nums = get_cur_idle_nums();
+            ret = copy_to_guest(u_xenpf_op, op, 1) ? -EFAULT : 0;
+            break;
+
+        default:
+            ret = -EINVAL;
+            break;
+        }
+    }
+    break;
+
     default:
         ret = -ENOSYS;
         break;
diff -r b7a1794aed59 -r f6a2fb739ad0 xen/common/Makefile
--- a/xen/common/Makefile       Fri Mar 23 13:45:28 2012 +0000
+++ b/xen/common/Makefile       Fri Mar 23 15:07:53 2012 +0000
@@ -1,4 +1,5 @@
 obj-y += bitmap.o
+obj-y += core_parking.o
 obj-y += cpu.o
 obj-y += cpupool.o
 obj-$(HAS_DEVICE_TREE) += device_tree.o
diff -r b7a1794aed59 -r f6a2fb739ad0 xen/common/core_parking.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/core_parking.c Fri Mar 23 15:07:53 2012 +0000
@@ -0,0 +1,13 @@
+#include <xen/types.h>
+
+static uint32_t cur_idle_nums;
+
+long core_parking_helper(void *data)
+{
+    return 0;
+}
+
+uint32_t get_cur_idle_nums(void)
+{
+    return cur_idle_nums;
+}
diff -r b7a1794aed59 -r f6a2fb739ad0 xen/include/public/platform.h
--- a/xen/include/public/platform.h     Fri Mar 23 13:45:28 2012 +0000
+++ b/xen/include/public/platform.h     Fri Mar 23 15:07:53 2012 +0000
@@ -490,6 +490,20 @@
     uint32_t flags;
 };
 
+#define XENPF_core_parking  60
+
+#define XEN_CORE_PARKING_SET 1
+#define XEN_CORE_PARKING_GET 2
+struct xenpf_core_parking {
+    /* IN variables */
+    uint32_t type;
+    /* IN variables:  set cpu nums expected to be idled */
+    /* OUT variables: get cpu nums actually be idled */
+    uint32_t idle_nums;
+};
+typedef struct xenpf_core_parking xenpf_core_parking_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_core_parking_t);
+
 struct xen_platform_op {
     uint32_t cmd;
     uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
@@ -511,6 +525,7 @@
         struct xenpf_cpu_ol            cpu_ol;
         struct xenpf_cpu_hotadd        cpu_add;
         struct xenpf_mem_hotadd        mem_add;
+        struct xenpf_core_parking      core_parking;
         uint8_t                        pad[128];
     } u;
 };

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.