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

[Xen-devel] [RFC][PATCH 04/13] Kemari: Kemari controller interface in libxc



This patch implements a userland interface against Kemari in the VMM.  Userland
programs control the VMM part of Kemari through this interface.  This patch
also modifies header files of libxc.

Signed-off-by: Yoshisato Yanagisawa <yanagisawa.yoshisato@xxxxxxxxxxxxx>
Signed-off-by: Yoshi Tamura <tamura.yoshiaki@xxxxxxxxxxxxx>
---
 tools/libxc/Makefile          |    2 +
 tools/libxc/xc_dom_kemari.c   |   79 ++++++++++++++++++++++++++++++++++++++++++
 tools/libxc/xenctrl.h         |   13 +++++-
 tools/libxc/xenguest.h        |   45 +++++++++++++++++++++++
 tools/libxc/xg_private.h      |    1
 tools/libxc/xg_save_restore.h |    2 -
 tools/xcutils/Makefile        |    1
 7 files changed, 140 insertions(+), 3 deletions(-)

diff -r 19201eebab16 tools/libxc/Makefile
--- a/tools/libxc/Makefile      Thu Sep 25 13:33:50 2008 +0100
+++ b/tools/libxc/Makefile      Wed Mar 04 17:04:19 2009 +0900
@@ -30,6 +30,8 @@
 GUEST_SRCS-y :=
 GUEST_SRCS-y += xg_private.c
 GUEST_SRCS-$(CONFIG_MIGRATE) += xc_domain_restore.c xc_domain_save.c
+GUEST_SRCS-$(CONFIG_MIGRATE) += xc_dom_kemari.c xc_dom_kemari_save.c
+GUEST_SRCS-$(CONFIG_MIGRATE) += xc_dom_kemari_restore.c
 GUEST_SRCS-$(CONFIG_HVM) += xc_hvm_build.c

 vpath %.c ../../xen/common/libelf
diff -r 19201eebab16 tools/libxc/xc_dom_kemari.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxc/xc_dom_kemari.c       Wed Mar 04 17:04:19 2009 +0900
@@ -0,0 +1,79 @@
+/*
+ * xc_dom_kemari.c
+ *
+ * The API for manipulating and obtaining information on kemari-domains.
+ *
+ * Copyright (C) 2008 Nippon Telegraph and Telephone Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include "xc_private.h"
+
+/*
+ * Kemari controller interface.
+ */
+int xc_kemari_control(int xc_handle,
+    uint32_t domid,
+    uint32_t cmd,
+    evtchn_port_t *port,
+    uint32_t *num_pages,
+    uint64_t *mfn,
+    uint16_t tap_mode)
+{
+    int rc;
+    struct xen_domctl_kemari_op *kemari_op;
+    DECLARE_DOMCTL;
+
+    domctl.cmd = XEN_DOMCTL_kemari_op;
+    domctl.domain = (domid_t)domid;
+
+    kemari_op = &domctl.u.kemari_op;
+    kemari_op->cmd = cmd;
+
+    if ( cmd == XEN_KEMARI_OP_attach )
+    {
+        kemari_op->u.attach.port = *port;
+        kemari_op->u.attach.evtchn_tap_mode = tap_mode;
+    }
+
+    if ( cmd /* == */ & XEN_KEMARI_OP_detach )
+        kemari_op->u.detach.port = *port;
+
+    DPRINTF("xc_kemari_control: cmd=%d\n", cmd);
+
+    rc = do_domctl(xc_handle, &domctl);
+
+    if ( cmd == XEN_KEMARI_OP_enable )
+    {
+        *port = kemari_op->u.enable.port;
+        *mfn = kemari_op->u.enable.mfn;
+        *num_pages = kemari_op->u.enable.num_pages;
+    }
+
+    return rc;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
diff -r 19201eebab16 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Thu Sep 25 13:33:50 2008 +0100
+++ b/tools/libxc/xenctrl.h     Wed Mar 04 17:04:21 2009 +0900
@@ -1009,8 +1009,8 @@
  */
 xc_error_handler xc_set_error_handler(xc_error_handler handler);

-int xc_set_hvm_param(int handle, domid_t dom, int param, unsigned long value);
-int xc_get_hvm_param(int handle, domid_t dom, int param, unsigned long *value);
+int xc_set_hvm_param(int handle, domid_t dom, int param, unsigned long long 
value);
+int xc_get_hvm_param(int handle, domid_t dom, int param, unsigned long long
*value);

 /* IA64 specific, nvram save */
 int xc_ia64_save_to_nvram(int xc_handle, uint32_t dom);
@@ -1150,4 +1150,13 @@
 int xc_pm_get_cxstat(int xc_handle, int cpuid, struct xc_cx_stat *cxpt);
 int xc_pm_reset_cxstat(int xc_handle, int cpuid);

+/* kemari control interface */
+int xc_kemari_control(int xc_handle,
+                      uint32_t domid,
+                      uint32_t cmd,
+                      evtchn_port_t *port,
+                      uint32_t *num_pages,
+                      uint64_t *mfn,
+                      uint16_t tap_mode);
+
 #endif /* XENCTRL_H */
diff -r 19201eebab16 tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h    Thu Sep 25 13:33:50 2008 +0100
+++ b/tools/libxc/xenguest.h    Wed Mar 04 17:04:21 2009 +0900
@@ -43,6 +43,51 @@
  * @return 0 on success, -1 on failure
  */
 int xc_domain_restore(int xc_handle, int io_fd, uint32_t dom,
+                      unsigned int store_evtchn, unsigned long *store_mfn,
+                      unsigned int console_evtchn, unsigned long *console_mfn,
+                      unsigned int hvm, unsigned int pae);
+
+/**
+ * This function will save a running domain for Kemari.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm fd the file descriptor to save a domain to
+ * @parm dom the id of the domain
+ * @return 0 on success, -1 on failure
+ */
+int xc_kemari_save(int xc_handle, int io_fd, uint32_t dom,
+                   void *kemari_ring, uint32_t flags /* XCFLAGS_xxx */,
+                   int hvm,
+                   void *(*init_qemu_maps)(int, unsigned));
+
+/**
+ * This function will update a domain for Kemari.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm fd the file descriptor to save a domain to
+ * @parm dom the id of the domain
+ * @return 0 on success, -1 on failure
+ */
+int xc_kemari_update(int xc_handle, int io_fd, uint32_t dom,
+                     void *kemari_ring, uint32_t flags,
+                     void (*qemu_save_image)(int),
+                     void (*qemu_end_flip)(void),
+                     void (*qemu_end_save)(void),
+                     void (*qemu_image_sent)(void));
+
+/**
+ * This function will restore a saved domain for Kemari.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm fd the file descriptor to restore a domain from
+ * @parm dom the id of the domain
+ * @parm store_evtchn the store event channel for this domain to use
+ * @parm store_mfn returned with the mfn of the store page
+ * @parm hvm non-zero if this is a HVM restore
+ * @parm pae non-zero if this HVM domain has PAE support enabled
+ * @return 0 on success, -1 on failure
+ */
+int xc_kemari_restore(int xc_handle, int io_fd, uint32_t dom,
                       unsigned int store_evtchn, unsigned long *store_mfn,
                       unsigned int console_evtchn, unsigned long *console_mfn,
                       unsigned int hvm, unsigned int pae);
diff -r 19201eebab16 tools/libxc/xg_private.h
--- a/tools/libxc/xg_private.h  Thu Sep 25 13:33:50 2008 +0100
+++ b/tools/libxc/xg_private.h  Wed Mar 04 17:04:22 2009 +0900
@@ -17,6 +17,7 @@

 #include <xen/memory.h>
 #include <xen/elfnote.h>
+#include <xen/kemari.h>

 #ifndef ELFSIZE
 #include <limits.h>
diff -r 19201eebab16 tools/libxc/xg_save_restore.h
--- a/tools/libxc/xg_save_restore.h     Thu Sep 25 13:33:50 2008 +0100
+++ b/tools/libxc/xg_save_restore.h     Wed Mar 04 17:04:22 2009 +0900
@@ -13,7 +13,7 @@
 ** We process save/restore/migrate in batches of pages; the below
 ** determines how many pages we (at maximum) deal with in each batch.
 */
-#define MAX_BATCH_SIZE 1024   /* up to 1024 pages (4MB) at a time */
+#define MAX_BATCH_SIZE 262144   /* up to 262144 pages (1GB) at a time */

 /* When pinning page tables at the end of restore, we also use batching. */
 #define MAX_PIN_BATCH  1024
diff -r 19201eebab16 tools/xcutils/Makefile
--- a/tools/xcutils/Makefile    Thu Sep 25 13:33:50 2008 +0100
+++ b/tools/xcutils/Makefile    Wed Mar 04 17:04:25 2009 +0900
@@ -19,6 +19,7 @@
 PROG_DEP = .*.d

 PROGRAMS = xc_restore xc_save readnotes lsevtchn
+PROGRAMS += xc_kemari_save xc_kemari_restore

 LDLIBS   = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore)



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


 


Rackspace

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