All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: xen-devel@lists.xen.org
Cc: Ian Campbell <ian.campbell@citrix.com>,
	FNST-Wen Congyang <wency@cn.fujitsu.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Jiang Yunhong <yunhong.jiang@intel.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Lai Jiangshan <laijs@cn.fujitsu.com>,
	Dong Eddie <eddie.dong@intel.com>,
	Shriram Rajagopalan <rshriram@cs.ubc.ca>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH 06/10 V7] remus: implement the API to buffer/release packages
Date: Mon, 10 Feb 2014 17:19:28 +0800	[thread overview]
Message-ID: <1392023972-24675-7-git-send-email-laijs@cn.fujitsu.com> (raw)
In-Reply-To: <1392023972-24675-1-git-send-email-laijs@cn.fujitsu.com>

From: Shriram Rajagopalan <rshriram@cs.ubc.ca>

This patch implements two APIs:
1. libxl__remus_netbuf_start_new_epoch()
   It marks a new epoch. The packages before this epoch will
   be flushed, and the packages after this epoch will be buffered.
   It will be called after the guest is suspended.
2. libxl__remus_netbuf_release_prev_epoch()
   It flushes the buffered packages to client, and it will be
   called when a checkpoint finishes.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Reviewed-by: Wen Congyang <wency@cn.fujitsu.com>
---
 tools/libxl/libxl_internal.h    |    6 ++++
 tools/libxl/libxl_netbuffer.c   |   49 +++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_nonetbuffer.c |   14 +++++++++++
 3 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 4006174..c13296b 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -2330,6 +2330,12 @@ _hidden void libxl__remus_teardown_done(libxl__egc *egc,
 _hidden void libxl__remus_netbuf_teardown(libxl__egc *egc,
                                           libxl__domain_suspend_state *dss);
 
+_hidden int libxl__remus_netbuf_start_new_epoch(libxl__gc *gc, uint32_t domid,
+                                               libxl__remus_state *remus_state);
+
+_hidden int libxl__remus_netbuf_release_prev_epoch(libxl__gc *gc, uint32_t domid,
+                                                  libxl__remus_state *remus_state);
+
 struct libxl__domain_suspend_state {
     /* set by caller of libxl__domain_suspend */
     libxl__ao *ao;
diff --git a/tools/libxl/libxl_netbuffer.c b/tools/libxl/libxl_netbuffer.c
index 2c77076..f358f4b 100644
--- a/tools/libxl/libxl_netbuffer.c
+++ b/tools/libxl/libxl_netbuffer.c
@@ -503,6 +503,55 @@ void libxl__remus_netbuf_teardown(libxl__egc *egc,
         libxl__remus_teardown_done(egc, dss);
 }
 
+/* The buffer_op's value, not the value passed to kernel */
+enum {
+    tc_buffer_start,
+    tc_buffer_release
+};
+
+static int remus_netbuf_op(libxl__gc *gc, uint32_t domid,
+                           libxl__remus_state *remus_state,
+                           int buffer_op)
+{
+    int i, ret;
+
+    /* Convenience aliases */
+    libxl__remus_netbuf_state *const netbuf_state = remus_state->netbuf_state;
+
+    for (i = 0; i < netbuf_state->num_netbufs; ++i) {
+        if (buffer_op == tc_buffer_start)
+            ret = rtnl_qdisc_plug_buffer(netbuf_state->netbuf_qdisc_list[i]);
+        else
+            ret = rtnl_qdisc_plug_release_one(netbuf_state->netbuf_qdisc_list[i]);
+
+        if (!ret)
+            ret = rtnl_qdisc_add(netbuf_state->nlsock,
+                                 netbuf_state->netbuf_qdisc_list[i],
+                                 NLM_F_REQUEST);
+        if (ret) {
+            LOG(ERROR, "Remus: cannot do netbuf op %s on %s:%s",
+                ((buffer_op == tc_buffer_start) ?
+                 "start_new_epoch" : "release_prev_epoch"),
+                netbuf_state->ifb_list[i], nl_geterror(ret));
+            return ERROR_FAIL;
+        }
+    }
+
+    return 0;
+}
+
+int libxl__remus_netbuf_start_new_epoch(libxl__gc *gc, uint32_t domid,
+                                        libxl__remus_state *remus_state)
+{
+    return remus_netbuf_op(gc, domid, remus_state, tc_buffer_start);
+}
+
+int libxl__remus_netbuf_release_prev_epoch(libxl__gc *gc, uint32_t domid,
+                                           libxl__remus_state *remus_state)
+{
+    return remus_netbuf_op(gc, domid, remus_state, tc_buffer_release);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libxl/libxl_nonetbuffer.c b/tools/libxl/libxl_nonetbuffer.c
index 559d0a6..92f35bc 100644
--- a/tools/libxl/libxl_nonetbuffer.c
+++ b/tools/libxl/libxl_nonetbuffer.c
@@ -33,6 +33,20 @@ void libxl__remus_netbuf_teardown(libxl__egc *egc,
 {
 }
 
+int libxl__remus_netbuf_start_new_epoch(libxl__gc *gc, uint32_t domid,
+                                        libxl__remus_state *remus_state)
+{
+    LOG(ERROR, "Remus: No support for network buffering");
+    return ERROR_FAIL;
+}
+
+int libxl__remus_netbuf_release_prev_epoch(libxl__gc *gc, uint32_t domid,
+                                           libxl__remus_state *remus_state)
+{
+    LOG(ERROR, "Remus: No support for network buffering");
+    return ERROR_FAIL;
+}
+
 /*
  * Local variables:
  * mode: C
-- 
1.7.1

  parent reply	other threads:[~2014-02-10  9:19 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02 11:04 [PATCH V8 0/8] Remus/Libxl: Network buffering support Yang Hongyang
2014-04-02 11:04 ` [PATCH V8 1/8] remus: add libnl3 dependency to autoconf scripts Yang Hongyang
2014-04-02 11:04 ` [PATCH V8 2/8] remus: introduce a function to check whether network buffering is enabled Yang Hongyang
2014-04-02 11:04 ` [PATCH V8 3/8] remus: Remus network buffering core and APIs to setup/teardown Yang Hongyang
2014-02-10  9:19   ` [PATCH 00/10 V7] Remus/Libxl: Network buffering support Lai Jiangshan
2014-02-10  9:19     ` [PATCH 01/10 V7] remus: add libnl3 dependency to autoconf scripts Lai Jiangshan
2014-02-10  9:19     ` [PATCH 02/10 V7] tools/libxl: update libxl_domain_remus_info Lai Jiangshan
2014-03-03 16:33       ` Ian Jackson
2014-02-10  9:19     ` [PATCH 03/10 V7] tools/libxl: introduce a new structure libxl__remus_state Lai Jiangshan
2014-03-03 16:38       ` Ian Jackson
2014-02-10  9:19     ` [PATCH 04/10 V7] remus: introduce a function to check whether network buffering is enabled Lai Jiangshan
2014-03-03 16:39       ` Ian Jackson
2014-02-10  9:19     ` [PATCH 05/10 V7] remus: Remus network buffering core and APIs to setup/teardown Lai Jiangshan
2014-03-03 17:44       ` Ian Jackson
2014-04-03 14:06         ` [PATCH 05/10 V7] remus: Remus network buffering core and APIs to setup/teardown [and 1 more messages] Ian Jackson
2014-02-10  9:19     ` Lai Jiangshan [this message]
2014-03-03 17:48       ` [PATCH 06/10 V7] remus: implement the API to buffer/release packages Ian Jackson
2014-02-10  9:19     ` [PATCH 07/10 V7] libxl: use the API to setup/teardown network buffering Lai Jiangshan
2014-03-03 17:51       ` Ian Jackson
2014-04-23 16:02         ` [PATCH 07/10 V7] libxl: use the API to setup/teardown network buffering [and 1 more messages] Ian Jackson
2014-04-23 16:55           ` Shriram Rajagopalan
2014-05-02 16:08             ` Ian Jackson
2014-05-02 21:59               ` Shriram Rajagopalan
2014-05-07  5:42               ` Hongyang Yang
2014-05-07 13:12                 ` Shriram Rajagopalan
2014-05-12 13:18                   ` Ian Jackson
2014-05-13  1:41                     ` Hongyang Yang
2014-02-10  9:19     ` [PATCH 08/10 V7] libxl: rename remus_failover_cb() to remus_replication_failure_cb() Lai Jiangshan
2014-03-03 17:52       ` Ian Jackson
2014-02-10  9:19     ` [PATCH 09/10 V7] libxl: control network buffering in remus callbacks Lai Jiangshan
2014-03-03 17:54       ` Ian Jackson
2014-02-10  9:19     ` [PATCH 10/10 V7] libxl: network buffering cmdline switch Lai Jiangshan
2014-03-03 17:58       ` Ian Jackson
2014-02-26  2:31     ` [PATCH 00/10 V7] Remus/Libxl: Network buffering support Lai Jiangshan
2014-02-26  2:53     ` [PATCH RFC] remus: implement remus replicated checkpointing disk Lai Jiangshan
2014-03-10 11:28       ` Ian Jackson
2014-03-10 12:34         ` Lai Jiangshan
2014-03-10 16:19           ` Ian Jackson
2014-03-11 18:10       ` Shriram Rajagopalan
2014-03-12  2:35         ` Lai Jiangshan
2014-03-12  6:23           ` Shriram Rajagopalan
2014-03-12 10:07           ` Ian Campbell
2014-03-12 11:57             ` Lai Jiangshan
2014-03-12 12:17               ` Ian Campbell
2014-03-12 12:28                 ` Lai Jiangshan
2014-03-12 10:06         ` Ian Campbell
2014-03-12 12:21           ` Lai Jiangshan
2014-04-02 11:04 ` [PATCH V8 4/8] remus: implement the API to buffer/release packages Yang Hongyang
2014-04-02 11:04 ` [PATCH V8 5/8] libxl: use the API to setup/teardown network buffering Yang Hongyang
2014-04-02 11:04 ` [PATCH V8 6/8] libxl: rename remus_failover_cb() to remus_replication_failure_cb() Yang Hongyang
2014-04-02 11:04 ` [PATCH V8 7/8] libxl: control network buffering in remus callbacks Yang Hongyang
2014-04-02 11:04 ` [PATCH V8 8/8] libxl: network buffering cmdline switch Yang Hongyang
2014-04-03 12:22   ` [PATCH 1/7] introduce a new function libxl__remus_netbuf_setup_done() Lai Jiangshan
2014-04-03 12:22     ` [PATCH 2/7] introduce a new function libxl__remus_netbuf_teardown_done() Lai Jiangshan
2014-04-03 12:22     ` [PATCH 3/7] introduce an API to async exec scripts Lai Jiangshan
2014-04-03 12:22     ` [PATCH 4/7] netbuffer: use async exec API to exec the netbuffer script Lai Jiangshan
2014-04-03 12:22     ` [PATCH 5/7] netbuf: move dev_id from remus_state to netbuf_state Lai Jiangshan
2014-04-03 12:22     ` [PATCH 6/7] remus: implement remus replicated checkpointing disk Lai Jiangshan
2014-04-03 16:41       ` Shriram Rajagopalan
2014-04-04  3:04         ` Lai Jiangshan
2014-04-03 12:22     ` [PATCH 7/7] drbd: implement " Lai Jiangshan
2014-04-03 16:07       ` Shriram Rajagopalan
2014-04-03 14:08     ` [PATCH 1/7] introduce a new function libxl__remus_netbuf_setup_done() Ian Jackson
2014-04-04  8:53       ` Hongyang Yang
2014-04-15  5:38 [PATCH V9 00/12] Remus/Libxl: Network buffering support Yang Hongyang
2014-04-15  5:38 ` [PATCH V9 01/12] introduce an API to async exec scripts Yang Hongyang
2014-04-23 15:44   ` Ian Jackson
2014-04-15  5:38 ` [PATCH V9 02/12] libxl_device: use async exec script api Yang Hongyang
2014-04-23 15:48   ` Ian Jackson
2014-04-15  5:38 ` [PATCH V9 03/12] remus: add libnl3 dependency to autoconf scripts Yang Hongyang
2014-04-15  5:38 ` [PATCH V9 04/12] remus: introduce a function to check whether network buffering is enabled Yang Hongyang
2014-04-23 15:50   ` Ian Jackson
2014-04-23 15:51     ` Shriram Rajagopalan
2014-04-30 14:36       ` Ian Jackson
2014-04-15  5:38 ` [PATCH V9 05/12] remus: remus device core and APIs to setup/teardown Yang Hongyang
2014-04-15  5:38 ` [PATCH V9 06/12] remus: implement the API for checkpoint Yang Hongyang
2014-04-23 16:04   ` Ian Jackson
2014-05-14  1:46     ` Hongyang Yang
2014-04-15  5:38 ` [PATCH V9 07/12] remus: Remus network buffering core and APIs to setup/teardown Yang Hongyang
2014-04-15  5:38 ` [PATCH V9 08/12] remus: implement the API to buffer/release packages Yang Hongyang
2014-04-23 16:10   ` Ian Jackson
2014-04-23 17:04     ` Shriram Rajagopalan
2014-05-02 16:10       ` Ian Jackson
2014-04-15  5:38 ` [PATCH V9 09/12] libxl: use the API to setup/teardown network buffering Yang Hongyang
2014-04-23 16:12   ` Ian Jackson
2014-04-16  2:55 ` [PATCH 1/2] drbd: implement replicated checkpointing disk Lai Jiangshan
2014-04-16  2:56   ` [PATCH 2/2] remus: support disk replicated checkpointing Lai Jiangshan
2014-04-23  9:53 ` [PATCH V9 00/12] Remus/Libxl: Network buffering support Hongyang Yang
2014-04-23 15:51 ` Ian Jackson

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=1392023972-24675-7-git-send-email-laijs@cn.fujitsu.com \
    --to=laijs@cn.fujitsu.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=eddie.dong@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=rshriram@cs.ubc.ca \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wency@cn.fujitsu.com \
    --cc=xen-devel@lists.xen.org \
    --cc=yunhong.jiang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.