From: Shriram Rajagopalan <rshriram@cs.ubc.ca>
To: xen-devel@lists.xensource.com
Cc: brendan@cs.ubc.ca
Subject: [PATCH] Change the global suspend event channel lock file to a per-domain lock file
Date: Tue, 27 Apr 2010 23:05:51 -0000 [thread overview]
Message-ID: <6d2bca1b77539d183037.1272409551@rshriram.cs.ubc.ca> (raw)
[-- Attachment #1: Type: text/plain, Size: 140 bytes --]
This allows multiple guests to be migrated or protected by Remus simultaneously.
Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
[-- Attachment #2: xen-unstable.hg.patch --]
[-- Type: text/x-patch, Size: 4930 bytes --]
# HG changeset patch
# User rshriram@rshriram.cs.ubc.ca
# Date 1272409464 25200
# Node ID 6d2bca1b77539d1830372887e874b55a6f7781f9
# Parent c87ec146229ab2255ecdf005b862b943b1a5112e
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@cs.ubc.ca>
diff -r c87ec146229a -r 6d2bca1b7753 tools/libxc/xc_suspend.c
--- a/tools/libxc/xc_suspend.c Fri Apr 23 15:04:26 2010 +0100
+++ b/tools/libxc/xc_suspend.c Tue Apr 27 16:04:24 2010 -0700
@@ -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 @@
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 @@
/* 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 @@
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 @@
cleanup:
if (suspend_evtchn != -1)
- xc_suspend_evtchn_release(xce, suspend_evtchn);
+ xc_suspend_evtchn_release(xce, domid, suspend_evtchn);
return -1;
}
diff -r c87ec146229a -r 6d2bca1b7753 tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h Fri Apr 23 15:04:26 2010 +0100
+++ b/tools/libxc/xenguest.h Tue Apr 27 16:04:24 2010 -0700
@@ -157,7 +157,7 @@
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 c87ec146229a -r 6d2bca1b7753 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c Fri Apr 23 15:04:26 2010 +0100
+++ b/tools/libxl/libxl_dom.c Tue Apr 27 16:04:24 2010 -0700
@@ -326,7 +326,7 @@
&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 c87ec146229a -r 6d2bca1b7753 tools/python/xen/lowlevel/checkpoint/libcheckpoint.c
--- a/tools/python/xen/lowlevel/checkpoint/libcheckpoint.c Fri Apr 23 15:04:26 2010 +0100
+++ b/tools/python/xen/lowlevel/checkpoint/libcheckpoint.c Tue Apr 27 16:04:24 2010 -0700
@@ -360,7 +360,7 @@
{
/* 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 c87ec146229a -r 6d2bca1b7753 tools/xcutils/xc_save.c
--- a/tools/xcutils/xc_save.c Fri Apr 23 15:04:26 2010 +0100
+++ b/tools/xcutils/xc_save.c Tue Apr 27 16:04:24 2010 -0700
@@ -210,7 +210,7 @@
&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);
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2010-04-27 23:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-27 23:05 Shriram Rajagopalan [this message]
2010-04-30 6:38 ` [PATCH] Change the global suspend event channel lock file to a per-domain lock file Brendan Cully
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6d2bca1b77539d183037.1272409551@rshriram.cs.ubc.ca \
--to=rshriram@cs.ubc.ca \
--cc=brendan@cs.ubc.ca \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).