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

[Xen-changelog] Merge



ChangeSet 1.1383, 2005/03/29 09:00:03+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Merge



 linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c |    4 
 tools/python/xen/lowlevel/xu/xu.c                |  893 +++++++++++++++--------
 xen/include/public/io/domain_controller.h        |  246 ++++++
 3 files changed, 847 insertions(+), 296 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c 
b/linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c
--- a/linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c  2005-03-29 04:03:20 
-05:00
+++ b/linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c  2005-03-29 04:03:20 
-05:00
@@ -80,7 +80,7 @@
     extern void time_suspend(void);
     extern void time_resume(void);
     extern unsigned long max_pfn;
-    extern unsigned long *pfn_to_mfn_frame_list;
+    extern unsigned int *pfn_to_mfn_frame_list;
 
     suspend_record = (suspend_record_t *)__get_free_page(GFP_KERNEL);
     if ( suspend_record == NULL )
@@ -109,10 +109,8 @@
 
     HYPERVISOR_vm_assist(VMASST_CMD_enable,
                         VMASST_TYPE_4gb_segments);
-#ifdef CONFIG_XEN_WRITABLE_PAGETABLES
     HYPERVISOR_vm_assist(VMASST_CMD_enable,
                         VMASST_TYPE_writable_pagetables);
-#endif
 
     shutting_down = -1; 
 
diff -Nru a/tools/python/xen/lowlevel/xu/xu.c 
b/tools/python/xen/lowlevel/xu/xu.c
--- a/tools/python/xen/lowlevel/xu/xu.c 2005-03-29 04:03:20 -05:00
+++ b/tools/python/xen/lowlevel/xu/xu.c 2005-03-29 04:03:20 -05:00
@@ -13,10 +13,10 @@
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
+#include <sys/un.h>
 #include <sys/mman.h>
 #include <sys/poll.h>
 #include <sys/sysmacros.h>
-#include <netinet/in.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
@@ -49,16 +49,9 @@
 /* Size of a machine page frame. */
 #define PAGE_SIZE 4096
 
-#if defined(__i386__)
-#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
-#define wmb() __asm__ __volatile__ ( "" : : : "memory" )
-#else
-#error "Define barriers"
-#endif
-
-
 /* Set the close-on-exec flag on a file descriptor.  Doesn't currently bother
  * to check for errors. */
+/*
 static void set_cloexec(int fd)
 {
     int flags = fcntl(fd, F_GETFD, 0);
@@ -69,7 +62,179 @@
     flags |= FD_CLOEXEC;
     fcntl(fd, F_SETFD, flags);
 }
+*/
+/*
+ * *********************** XCS INTERFACE ***********************
+ */
+
+#include <arpa/inet.h>
+#include <xcs_proto.h>
+
+static int xcs_ctrl_fd = -1; /* control connection to the xcs server. */
+static int xcs_data_fd = -1; /*    data connection to the xcs server. */
+static u32 xcs_session_id = 0;
+
+static int xcs_ctrl_send(xcs_msg_t *msg);
+static int xcs_ctrl_read(xcs_msg_t *msg);
+static int xcs_data_send(xcs_msg_t *msg);
+static int xcs_data_read(xcs_msg_t *msg);
+
+static int xcs_connect(char *path)
+{
+    struct sockaddr_un addr;
+    int ret, len, flags;
+    xcs_msg_t msg;
+
+    if (xcs_data_fd != -1) /* already connected */
+        return 0;
+    
+    xcs_ctrl_fd = socket(AF_UNIX, SOCK_STREAM, 0);
+    if (xcs_ctrl_fd < 0)
+    {
+        printf("error creating xcs socket!\n");
+        goto fail;
+    }
+    
+    addr.sun_family = AF_UNIX;
+    strcpy(addr.sun_path, path);
+    len = sizeof(addr.sun_family) + strlen(addr.sun_path) + 1;
+
+    ret = connect(xcs_ctrl_fd, (struct sockaddr *)&addr, len);
+    if (ret < 0) 
+    {
+        printf("error connecting to xcs(ctrl)! (%d)\n", errno);
+        goto ctrl_fd_fail;
+    }
+
+    /*set_cloexec(xcs_ctrl_fd);*/
+            
+    msg.type = XCS_CONNECT_CTRL;
+    msg.u.connect.session_id = xcs_session_id;
+    xcs_ctrl_send(&msg);
+    xcs_ctrl_read(&msg); /* TODO: timeout + error! */
+    
+    if (msg.result != XCS_RSLT_OK)
+    {
+        printf("error connecting xcs control channel!\n");
+        goto ctrl_fd_fail;
+    }
+    xcs_session_id = msg.u.connect.session_id;
+    
+    /* now the data connection. */
+    xcs_data_fd = socket(AF_UNIX, SOCK_STREAM, 0);
+    if (xcs_data_fd < 0)
+    {
+        printf("error creating xcs data socket!\n");
+        goto ctrl_fd_fail;
+    }
+    
+    addr.sun_family = AF_UNIX;
+    strcpy(addr.sun_path, path);
+    len = sizeof(addr.sun_family) + strlen(addr.sun_path) + 1;
+    
+    ret = connect(xcs_data_fd, (struct sockaddr *)&addr, len);
+    if (ret < 0) 
+    {
+        printf("error connecting to xcs(data)! (%d)\n", errno);
+        goto data_fd_fail;
+    }
+
+    //set_cloexec(xcs_data_fd);
+    msg.type = XCS_CONNECT_DATA;
+    msg.u.connect.session_id = xcs_session_id;
+    xcs_data_send(&msg);
+    xcs_data_read(&msg); /* TODO: timeout + error! */
+    
+    if (msg.result != XCS_RSLT_OK)
+    {
+        printf("error connecting xcs control channel!\n");
+        goto ctrl_fd_fail;
+    }
+    
+    if ( ((flags = fcntl(xcs_data_fd, F_GETFL, 0)) < 0) ||
+        (fcntl(xcs_data_fd, F_SETFL, flags | O_NONBLOCK) < 0) )
+    {
+        printf("Unable to set non-blocking status on data socket.");
+        goto data_fd_fail;
+    }
+    
+    return 0;
+
+data_fd_fail: 
+    close(xcs_data_fd);  
+    xcs_data_fd = -1;  
+    
+ctrl_fd_fail:
+    close(xcs_ctrl_fd);
+    xcs_ctrl_fd = -1; 
+     
+fail:
+    return -1;
+    
+}
+
+static void xcs_disconnect(void)
+{
+    close(xcs_data_fd);
+    xcs_data_fd = -1;
+    close(xcs_ctrl_fd);
+    xcs_ctrl_fd = -1;
+}
+
+static int xcs_ctrl_read(xcs_msg_t *msg)
+{
+    int ret;
+    
+    ret = read(xcs_ctrl_fd, msg, sizeof(xcs_msg_t));
+    return ret;
+}
+
+static int xcs_ctrl_send(xcs_msg_t *msg)
+{
+    int ret;
+    
+    ret = send(xcs_ctrl_fd, msg, sizeof(xcs_msg_t), 0);
+    return ret;
+}
 
+static int xcs_data_read(xcs_msg_t *msg)
+{
+    int ret;
+    
+    ret = read(xcs_data_fd, msg, sizeof(xcs_msg_t));
+    return ret;
+}
+
+static int xcs_data_send(xcs_msg_t *msg)
+{
+    int ret;
+    
+    ret = send(xcs_data_fd, msg, sizeof(xcs_msg_t), 0);
+    return ret;
+}
+
+
+typedef struct kme_st {
+    xcs_msg_t         msg;
+    struct kme_st    *next;
+} xcs_msg_ent_t;
+    
+
+#define XCS_RING_SIZE 64
+static xcs_msg_ent_t *req_ring[64];
+static unsigned req_prod = 0;
+static unsigned req_cons = 0;
+
+static xcs_msg_ent_t *rsp_ring[64];
+static unsigned rsp_prod = 0;
+static unsigned rsp_cons = 0;
+
+#define REQ_RING_ENT(_idx) (req_ring[(_idx) % XCS_RING_SIZE])
+#define RSP_RING_ENT(_idx) (rsp_ring[(_idx) % XCS_RING_SIZE]) 
+#define REQ_RING_FULL ( req_prod - req_cons == XCS_RING_SIZE )
+#define RSP_RING_FULL ( rsp_prod - rsp_cons == XCS_RING_SIZE )
+#define REQ_RING_EMPTY ( req_prod == req_cons )
+#define RSP_RING_EMPTY ( rsp_prod == rsp_cons )
 /*
  * *********************** NOTIFIER ***********************
  */
@@ -81,81 +246,136 @@
 
 static PyObject *xu_notifier_read(PyObject *self, PyObject *args)
 {
-    xu_notifier_object *xun = (xu_notifier_object *)self;
-    u16 v;
-    int bytes;
+    xcs_msg_ent_t *ent;
+    int ret;
 
     if ( !PyArg_ParseTuple(args, "") )
         return NULL;
-    
-    while ( (bytes = read(xun->evtchn_fd, &v, sizeof(v))) == -1 )

_______________________________________________
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®.