qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Orit Wasserman <owasserm@redhat.com>
To: qemu-devel@nongnu.org
Cc: blauwirbel@gmail.com, stefanha@gmail.com,
	Orit Wasserman <owasserm@redhat.com>,
	avi@redhat.com, quintela@redhat.com
Subject: [Qemu-devel] [PATCH v7 07/11] Add XBZRLE parameters to MigrationState
Date: Thu, 26 Jan 2012 16:24:53 +0200	[thread overview]
Message-ID: <1327587897-31192-8-git-send-email-owasserm@redhat.com> (raw)
In-Reply-To: <1327587897-31192-1-git-send-email-owasserm@redhat.com>


Signed-off-by: Orit Wasserman <owasserm@redhat.com>
---
 arch_init.c |    5 +++++
 migration.c |    8 ++++++++
 migration.h |    4 ++++
 savevm.c    |    9 ++++++---
 4 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index 4ebf080..f864585 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -179,6 +179,11 @@ typedef struct ArchMigrationState {
 
 static ArchMigrationState arch_mig_state;
 
+void arch_set_params(const MigrationParams *params, void *opaque)
+{
+    arch_mig_state.use_xbzrle = params->use_xbzrle;
+    arch_mig_state.xbzrle_cache_size = params->xbzrle_cache_size;
+}
 /***********************************************************/
 /* XBRLE page cache implementation */
 static CacheItem *cache_item_get(unsigned long pos, int item)
diff --git a/migration.c b/migration.c
index c90740a..ce039e3 100644
--- a/migration.c
+++ b/migration.c
@@ -43,6 +43,11 @@ enum {
 
 #define MAX_THROTTLE  (32 << 20)      /* Migration speed throttling */
 
+/* Migration XBZRLE cache size */
+#define DEFAULT_MIGRATE_CACHE_SIZE (64 * 1024 * 1024)
+
+static int64_t migrate_cache_size = DEFAULT_MIGRATE_CACHE_SIZE;
+
 static NotifierList migration_state_notifiers =
     NOTIFIER_LIST_INITIALIZER(migration_state_notifiers);
 
@@ -425,6 +430,9 @@ int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
     params.blk = qdict_get_try_bool(qdict, "blk", 0);
     params.shared = qdict_get_try_bool(qdict, "inc", 0);
 
+    params.use_xbzrle = qdict_get_try_bool(qdict, "xbzrle", 0);
+    params.xbzrle_cache_size =  migrate_cache_size;
+
     if (s->state == MIG_STATE_ACTIVE) {
         monitor_printf(mon, "migration already in progress\n");
         return -1;
diff --git a/migration.h b/migration.h
index 6362136..7e1c7c0 100644
--- a/migration.h
+++ b/migration.h
@@ -22,6 +22,8 @@
 struct MigrationParams {
     int blk;
     int shared;
+    int use_xbzrle;
+    int64_t xbzrle_cache_size;
 };
 
 typedef struct MigrationState MigrationState;
@@ -107,4 +109,6 @@ int encode_page(uint8_t *old_buf, uint8_t *new_buf, int slen,
                 uint8_t *dst, int dlen);
 int decode_page(uint8_t *src, int slen, uint8_t *dst, int dlen);
 
+void arch_set_params(const MigrationParams *params, void *opaque);
+
 #endif
diff --git a/savevm.c b/savevm.c
index 2d36d0c..bb93429 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1278,7 +1278,8 @@ int register_savevm(DeviceState *dev,
                     void *opaque)
 {
     return register_savevm_live(dev, idstr, instance_id, version_id,
-                                NULL, NULL, save_state, load_state, opaque);
+                                arch_set_params, NULL, save_state,
+                                load_state, opaque);
 }
 
 void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque)
@@ -1566,7 +1567,7 @@ int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f,
 	}
         se->set_params(params, se->opaque);
     }
-    
+
     qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
     qemu_put_be32(f, QEMU_VM_FILE_VERSION);
 
@@ -1704,7 +1705,9 @@ static int qemu_savevm_state(Monitor *mon, QEMUFile *f)
     int ret;
     MigrationParams params = {
         .blk = 0,
-        .shared = 0
+        .shared = 0,
+        .use_xbzrle = 0,
+        .xbzrle_cache_size = 0
     };
 
     if (qemu_savevm_state_blocked(mon)) {
-- 
1.7.6.5

  parent reply	other threads:[~2012-01-26 14:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-26 14:24 [Qemu-devel] [PATCH v7 00/11] XBRLE delta for live migration of large memory app Orit Wasserman
2012-01-26 14:24 ` [Qemu-devel] [PATCH v7 01/11] Add cache handling functions Orit Wasserman
2012-01-26 14:24 ` [Qemu-devel] [PATCH v7 02/11] Add uleb encoding/decoding functions Orit Wasserman
2012-01-26 14:24 ` [Qemu-devel] [PATCH v7 03/11] Add save_block_hdr function Orit Wasserman
2012-01-26 14:24 ` [Qemu-devel] [PATCH v7 04/11] Add host_from_stream_offset_versioned function Orit Wasserman
2012-01-26 14:24 ` [Qemu-devel] [PATCH v7 05/11] Add XBZRLE to ram_save_block and ram_save_live Orit Wasserman
2012-01-29 10:52   ` Avi Kivity
2012-01-26 14:24 ` [Qemu-devel] [PATCH v7 06/11] Add MigrationParams structure Orit Wasserman
2012-01-26 14:24 ` Orit Wasserman [this message]
2012-01-26 14:24 ` [Qemu-devel] [PATCH v7 08/11] Add migration capabilties Orit Wasserman
2012-01-26 14:24 ` [Qemu-devel] [PATCH v7 09/11] Add set_cachesize command Orit Wasserman
2012-01-26 14:24 ` [Qemu-devel] [PATCH v7 10/11] Add XBZRLE option to migrate command Orit Wasserman
2012-01-26 14:24 ` [Qemu-devel] [PATCH v7 11/11] Add XBZRLE statstics information Orit Wasserman
2012-02-24  8:33 ` [Qemu-devel] [PATCH v7 00/11] XBRLE delta for live migration of large memory app Stefan Hajnoczi

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=1327587897-31192-8-git-send-email-owasserm@redhat.com \
    --to=owasserm@redhat.com \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@gmail.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).