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] Change the global suspend event channel l

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Change the global suspend event channel lock file to a per-domain lock file
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 04 May 2010 13:20:37 -0700
Delivery-date: Tue, 04 May 2010 13:24:57 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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.fraser@xxxxxxxxxx>
# Date 1272971548 -3600
# Node ID f7605c6c9548ff497e7fb9d48b7713290e245d1c
# Parent  31a6937e2359ffcbf973a9c2fa95879a02880bbe
Change the global suspend event channel lock file to a per-domain lock file

This allows multiple guests to be migrated or protected by Remus
simultaneously.

Signed-off-by: Shriram Rajagopalan <rshriram@xxxxxxxxx>
Acked-by: Brendan Cully <brendan@xxxxxxxxx>
---
 tools/libxc/xc_suspend.c                             |   29 +++++++++++--------
 tools/libxc/xenguest.h                               |    2 -
 tools/libxl/libxl_dom.c                              |    2 -
 tools/python/xen/lowlevel/checkpoint/libcheckpoint.c |    2 -
 tools/xcutils/xc_save.c                              |    2 -
 5 files changed, 22 insertions(+), 15 deletions(-)

diff -r 31a6937e2359 -r f7605c6c9548 tools/libxc/xc_suspend.c
--- a/tools/libxc/xc_suspend.c  Tue May 04 12:10:54 2010 +0100
+++ b/tools/libxc/xc_suspend.c  Tue May 04 12:12:28 2010 +0100
@@ -7,18 +7,22 @@
 #include "xc_private.h"
 #include "xenguest.h"
 
-#define SUSPEND_LOCK_FILE "/var/lib/xen/suspend_evtchn_lock.d"
-static int lock_suspend_event(void)
+#define SUSPEND_LOCK_FILE "/var/lib/xen/suspend_evtchn"
+static int lock_suspend_event(int domid)
 {
     int fd, rc;
     mode_t mask;
     char buf[128];
+    char suspend_file[256];
 
+    snprintf(suspend_file, sizeof(suspend_file), "%s_%d_lock.d",
+           SUSPEND_LOCK_FILE, domid);
     mask = umask(022);
-    fd = open(SUSPEND_LOCK_FILE, O_CREAT | O_EXCL | O_RDWR, 0666);
+    fd = open(suspend_file, O_CREAT | O_EXCL | O_RDWR, 0666);
     if (fd < 0)
     {
-        ERROR("Can't create lock file for suspend event channel\n");
+        ERROR("Can't create lock file for suspend event channel %s\n",
+               suspend_file);
         return -EINVAL;
     }
     umask(mask);
@@ -30,12 +34,15 @@ static int lock_suspend_event(void)
     return rc;
 }
 
-static int unlock_suspend_event(void)
+static int unlock_suspend_event(int domid)
 {
     int fd, pid, n;
     char buf[128];
+    char suspend_file[256];
 
-    fd = open(SUSPEND_LOCK_FILE, O_RDWR);
+    snprintf(suspend_file, sizeof(suspend_file), "%s_%d_lock.d",
+           SUSPEND_LOCK_FILE, domid);
+    fd = open(suspend_file, O_RDWR);
 
     if (fd < 0)
         return -EINVAL;
@@ -50,7 +57,7 @@ static int unlock_suspend_event(void)
         /* We are the owner, so we can simply delete the file */
         if (pid == getpid())
         {
-            unlink(SUSPEND_LOCK_FILE);
+            unlink(suspend_file);
             return 0;
         }
     }
@@ -77,19 +84,19 @@ int xc_await_suspend(int xce, int suspen
     return 0;
 }
 
-int xc_suspend_evtchn_release(int xce, int suspend_evtchn)
+int xc_suspend_evtchn_release(int xce, int domid, int suspend_evtchn)
 {
     if (suspend_evtchn >= 0)
         xc_evtchn_unbind(xce, suspend_evtchn);
 
-    return unlock_suspend_event();
+    return unlock_suspend_event(domid);
 }
 
 int xc_suspend_evtchn_init(int xc, int xce, int domid, int port)
 {
     int rc, suspend_evtchn = -1;
 
-    if (lock_suspend_event())
+    if (lock_suspend_event(domid))
         return -EINVAL;
 
     suspend_evtchn = xc_evtchn_bind_interdomain(xce, domid, port);
@@ -111,7 +118,7 @@ int xc_suspend_evtchn_init(int xc, int x
 
 cleanup:
     if (suspend_evtchn != -1)
-        xc_suspend_evtchn_release(xce, suspend_evtchn);
+        xc_suspend_evtchn_release(xce, domid, suspend_evtchn);
 
     return -1;
 }
diff -r 31a6937e2359 -r f7605c6c9548 tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h    Tue May 04 12:10:54 2010 +0100
+++ b/tools/libxc/xenguest.h    Tue May 04 12:12:28 2010 +0100
@@ -157,7 +157,7 @@ int xc_hvm_build_mem(int xc_handle,
                      const char *image_buffer,
                      unsigned long image_size);
 
-int xc_suspend_evtchn_release(int xce, int suspend_evtchn);
+int xc_suspend_evtchn_release(int xce, int domid, int suspend_evtchn);
 
 int xc_suspend_evtchn_init(int xc, int xce, int domid, int port);
 
diff -r 31a6937e2359 -r f7605c6c9548 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Tue May 04 12:10:54 2010 +0100
+++ b/tools/libxl/libxl_dom.c   Tue May 04 12:12:28 2010 +0100
@@ -326,7 +326,7 @@ int core_suspend(struct libxl_ctx *ctx, 
                    &core_suspend_switch_qemu_logdirty);
 
     if (si.suspend_eventchn > 0)
-        xc_suspend_evtchn_release(si.xce, si.suspend_eventchn);
+        xc_suspend_evtchn_release(si.xce, domid, si.suspend_eventchn);
     if (si.xce > 0)
         xc_evtchn_close(si.xce);
 
diff -r 31a6937e2359 -r f7605c6c9548 
tools/python/xen/lowlevel/checkpoint/libcheckpoint.c
--- a/tools/python/xen/lowlevel/checkpoint/libcheckpoint.c      Tue May 04 
12:10:54 2010 +0100
+++ b/tools/python/xen/lowlevel/checkpoint/libcheckpoint.c      Tue May 04 
12:12:28 2010 +0100
@@ -360,7 +360,7 @@ static void release_suspend_evtchn(check
 {
   /* TODO: teach xen to clean up if port is unbound */
   if (s->xce >= 0 && s->suspend_evtchn >= 0) {
-    xc_suspend_evtchn_release(s->xce, s->suspend_evtchn);
+    xc_suspend_evtchn_release(s->xce, s->domid, s->suspend_evtchn);
     s->suspend_evtchn = -1;
   }
 }
diff -r 31a6937e2359 -r f7605c6c9548 tools/xcutils/xc_save.c
--- a/tools/xcutils/xc_save.c   Tue May 04 12:10:54 2010 +0100
+++ b/tools/xcutils/xc_save.c   Tue May 04 12:12:28 2010 +0100
@@ -210,7 +210,7 @@ main(int argc, char **argv)
                          &switch_qemu_logdirty);
 
     if (si.suspend_evtchn > 0)
-        xc_suspend_evtchn_release(si.xce, si.suspend_evtchn);
+        xc_suspend_evtchn_release(si.xce, si.domid, si.suspend_evtchn);
 
     if (si.xce > 0)
         xc_evtchn_close(si.xce);

_______________________________________________
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] Change the global suspend event channel lock file to a per-domain lock file, Xen patchbot-unstable <=