From: Shriram Rajagopalan <rshriram@cs.ubc.ca>
To: xen-devel@lists.xen.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH 4 of 5 V3] tools/libxl: Control network buffering in remus callbacks
Date: Sun, 20 Oct 2013 22:58:06 -0700 [thread overview]
Message-ID: <a8deb9499e9dcce98690.1382335086@athos.nss.cs.ubc.ca> (raw)
In-Reply-To: <patchbomb.1382335082@athos.nss.cs.ubc.ca>
# HG changeset patch
# User Shriram Rajagopalan <rshriram@cs.ubc.ca>
# Date 1382295546 25200
# Node ID a8deb9499e9dcce9869025fa1c02cf2e0d58612a
# Parent d3f088236c550213fc04ed982df47b4771b28d2f
tools/libxl: Control network buffering in remus callbacks
This patch constitutes the core network buffering logic.
and does the following:
a) create a new network buffer when the domain is suspended
(remus_domain_suspend_callback)
b) release the previous network buffer pertaining to the
committed checkpoint (remus_domain_checkpoint_dm_saved)
Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
diff -r d3f088236c55 -r a8deb9499e9d tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c Sun Oct 20 11:54:26 2013 -0700
+++ b/tools/libxl/libxl_dom.c Sun Oct 20 11:59:06 2013 -0700
@@ -1259,8 +1259,24 @@ void libxl__remus_teardown_done(libxl__e
static int libxl__remus_domain_suspend_callback(void *data)
{
- /* REMUS TODO: Issue disk and network checkpoint reqs. */
- return libxl__domain_suspend_common_callback(data);
+ /* REMUS TODO: Issue disk checkpoint reqs. */
+ libxl__save_helper_state *shs = data;
+ libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs);
+ libxl__remus_ctx *remus_ctx = dss->remus_ctx;
+ bool is_suspended;
+ STATE_AO_GC(dss->ao);
+
+ is_suspended = !!libxl__domain_suspend_common_callback(data);
+
+ if (!remus_ctx->netbuf_ctx) return is_suspended;
+
+ if (is_suspended) {
+ if (libxl__remus_netbuf_start_new_epoch(gc, dss->domid,
+ remus_ctx))
+ return !is_suspended;
+ }
+
+ return is_suspended;
}
static int libxl__remus_domain_resume_callback(void *data)
@@ -1273,7 +1289,7 @@ static int libxl__remus_domain_resume_ca
if (libxl__domain_resume(gc, dss->domid, /* Fast Suspend */1))
return 0;
- /* REMUS TODO: Deal with disk. Start a new network output buffer */
+ /* REMUS TODO: Deal with disk. */
return 1;
}
@@ -1300,11 +1316,42 @@ static void libxl__remus_domain_checkpoi
static void remus_checkpoint_dm_saved(libxl__egc *egc,
libxl__domain_suspend_state *dss, int rc)
{
- /* REMUS TODO: Wait for disk and memory ack, release network buffer */
- /* REMUS TODO: make this asynchronous */
- assert(!rc); /* REMUS TODO handle this error properly */
- usleep(dss->remus_ctx->interval * 1000);
- libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, 1);
+ /*
+ * REMUS TODO: Wait for disk and explicit memory ack (through restore
+ * callback from remote) before releasing network buffer.
+ */
+ libxl__remus_ctx *remus_ctx = dss->remus_ctx;
+ struct timespec epoch;
+ int do_next_iter = 0;
+ STATE_AO_GC(dss->ao);
+
+ if (rc) {
+ LOG(ERROR, "Failed to save device model. Terminating Remus..");
+ goto out;
+ }
+
+ if (remus_ctx->netbuf_ctx) {
+ rc = libxl__remus_netbuf_release_prev_epoch(gc, dss->domid,
+ remus_ctx);
+ if (rc) {
+ LOG(ERROR, "Failed to release network buffer."
+ " Terminating Remus..");
+ goto out;
+ }
+ }
+
+ epoch.tv_sec = remus_ctx->interval / 1000; /* interval is in ms */
+ epoch.tv_nsec = remus_ctx->interval * 1000L * 1000L;
+ nanosleep(&epoch, 0);
+ /*
+ * Set return value to 1, so that the infinite checkpoint cycle
+ * continues. See xc_domain_save.c: xc_domain_save()
+ */
+ do_next_iter = 1;
+
+ out:
+ libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs,
+ do_next_iter);
}
/*----- main code for suspending, in order of execution -----*/
next prev parent reply other threads:[~2013-10-21 5:58 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-21 5:58 [PATCH 0 of 5 V3] Remus/Libxl: Network buffering support Shriram Rajagopalan
2013-10-21 5:58 ` [PATCH 1 of 5 V3] remus: add libnl3 dependency to autoconf scripts Shriram Rajagopalan
2013-10-31 20:13 ` Ian Campbell
2013-10-21 5:58 ` [PATCH 2 of 5 V3] tools/hotplug: Remus network buffering setup scripts Shriram Rajagopalan
2013-10-31 20:21 ` Ian Campbell
2013-10-31 21:06 ` Shriram Rajagopalan
2013-10-31 22:25 ` Ian Campbell
2013-11-14 3:55 ` Shriram Rajagopalan
2013-10-21 5:58 ` [PATCH 3 of 5 V3] tools/libxl: setup/teardown Remus network buffering Shriram Rajagopalan
2013-10-31 20:28 ` Ian Campbell
2013-10-21 5:58 ` Shriram Rajagopalan [this message]
2013-10-31 20:31 ` [PATCH 4 of 5 V3] tools/libxl: Control network buffering in remus callbacks Ian Campbell
2013-11-01 18:28 ` Ian Jackson
2013-11-01 19:57 ` Shriram Rajagopalan
2013-11-04 12:12 ` [PATCH 4 of 5 V3] tools/libxl: Control network buffering in remus callbacks [and 1 more messages] Ian Jackson
2013-11-04 15:17 ` Shriram Rajagopalan
2013-11-04 15:32 ` Ian Campbell
2013-11-04 16:06 ` Ian Jackson
2013-11-04 16:40 ` [PATCH 4 of 5 V3] tools/libxl: Control network buffering in remus callbacks [and 1 more messages] " Ian Jackson
2013-11-11 17:56 ` Shriram Rajagopalan
2013-11-12 9:48 ` Ian Campbell
2013-11-12 15:38 ` Ian Jackson
2013-11-12 16:24 ` Shriram Rajagopalan
2013-11-12 16:38 ` Ian Jackson
2013-11-12 16:43 ` Shriram Rajagopalan
2013-11-12 17:00 ` Ian Jackson
2013-11-04 16:45 ` [PATCH 4 of 5 V3] tools/libxl: Control network buffering in remus callbacks " Ian Campbell
2013-11-04 16:47 ` Shriram Rajagopalan
2013-11-04 17:01 ` Ian Jackson
2013-11-04 17:23 ` Shriram Rajagopalan
2013-11-04 17:33 ` Ian Jackson
2013-11-01 20:04 ` [PATCH 4 of 5 V3] tools/libxl: Control network buffering in remus callbacks Shriram Rajagopalan
2013-10-21 5:58 ` [PATCH 5 of 5 V3] tools/xl: Remus - Network buffering cmdline switch Shriram Rajagopalan
2013-10-31 20:38 ` Ian Campbell
2013-10-31 21:47 ` Shriram Rajagopalan
2013-10-31 22:29 ` Ian Campbell
2013-10-30 23:05 ` [PATCH 0 of 5 V3] Remus/Libxl: Network buffering support Shriram Rajagopalan
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=a8deb9499e9dcce98690.1382335086@athos.nss.cs.ubc.ca \
--to=rshriram@cs.ubc.ca \
--cc=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/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).