Skip to contentSkip to conversation

migration: small fixes

GIT PULL Applied Amit Shah 5 participants 19 messages Feb 5, 2016 – Apr 7, 2016

lore
Share & tools
lore

Amit Shah

author
#0 lore raw

The following changes since commit d38ea87ac54af64ef611de434d07c12dc0399216:

all: Clean up includes (2016-02-04 17:41:30 +0000)

are available in the git repository at:

https://git.kernel.org/pub/scm/virt/qemu/amit/migration.git tags/migration-for-2.6-2

for you to fetch changes up to 15d61692da651fc79b3fc40050b986c5a73055c0:

migration: fix bad string passed to error_report() (2016-02-05 19:09:51 +0530)

----------------------------------------------------------------
Migration pull req.

Small fixes, nothing major.

----------------------------------------------------------------

Amit Shah (1):
static checker: e1000-82540em got aliased to e1000

Greg Kurz (1):
migration: fix bad string passed to error_report()

Liang Li (1):
migration: remove useless code.

zhanghailiang (6):
ram: Split host_from_stream_offset() into two helper functions
migration: rename 'file' in MigrationState to 'to_dst_file'
savevm: Split load vm state function qemu_loadvm_state migration/ram: Fix some helper functions' parameter to use
PageSearchStatus
qmp-commands.hx: Fix the missing options for migration parameters
commands
qmp-commands.hx: Document the missing options for migration capability
commands

 include/exec/ram_addr.h           |   8 +-
 include/migration/migration.h     |   2 +-
 migration/exec.c                  |   4 +-
 migration/fd.c                    |   4 +-
 migration/migration.c             |  78 +++++++++---------
 migration/postcopy-ram.c          |   6 +-
 migration/ram.c                   |  73 ++++++++++-------
 migration/rdma.c                  |   2 +-
 migration/savevm.c                | 162 ++++++++++++++++++++++----------------
 migration/tcp.c                   |   4 +-
 migration/unix.c                  |   4 +-
 qmp-commands.hx                   |  33 ++++++--
 scripts/vmstate-static-checker.py |   1 +
 13 files changed, 225 insertions(+), 156 deletions(-)
Signature · 1 line
2.5.0
author
#1 lore raw

[Qemu-devel] [PULL 1/9] ram: Split host_from_stream_offset() into two helper functions

From: zhanghailiang <[email protected]>

Split host_from_stream_offset() into two parts:
One is to get ram block, which the block idstr may be get from migration stream, the other is to get hva (host) address from block and the offset. Besides, we will do the check working in a new helper offset_in_ramblock().

Message-Id: <[email protected]>

---
 include/exec/ram_addr.h |  8 ++++++--
 migration/ram.c         | 40 +++++++++++++++++++++++++---------------
 2 files changed, 31 insertions(+), 17 deletions(-)
include/exec/ram_addr.h +6 -2
index ef1489d..606e277 100644
@@ -38,10 +38,14 @@ struct RAMBlock {
     int fd;
 };
 
+static inline bool offset_in_ramblock(RAMBlock *b, ram_addr_t offset)
+{
+    return (b && b->host && offset < b->used_length) ? true : false;
+}
+
 static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
 {
-    assert(offset < block->used_length);
-    assert(block->host);
+    assert(offset_in_ramblock(block, offset));
     return (char *)block->host + offset;
 }
 
migration/ram.c +25 -15
index 40d0533..b541ceb 100644
@@ -2124,28 +2124,24 @@ static int load_xbzrle(QEMUFile *f, ram_addr_t addr, void *host)
  * Returns a pointer from within the RCU-protected ram_list.
  */
 /*
- * Read a RAMBlock ID from the stream f, find the host address of the
- * start of that block and add on 'offset'
+ * Read a RAMBlock ID from the stream f.
  *
  * f: Stream to read from
- * offset: Offset within the block
  * flags: Page flags (mostly to see if it's a continuation of previous block)
  */
-static inline void *host_from_stream_offset(QEMUFile *f,
-                                            ram_addr_t offset,
-                                            int flags)
+static inline RAMBlock *ram_block_from_stream(QEMUFile *f,
+                                              int flags)
 {
     static RAMBlock *block = NULL;
     char id[256];
     uint8_t len;
 
     if (flags & RAM_SAVE_FLAG_CONTINUE) {
-        if (!block || block->max_length <= offset) {
+        if (!block) {
             error_report("Ack, bad migration stream!");
             return NULL;
         }
-
-        return block->host + offset;
+        return block;
     }
 
     len = qemu_get_byte(f);
@@ -2153,12 +2149,22 @@ static inline void *host_from_stream_offset(QEMUFile *f,
     id[len] = 0;
 
     block = qemu_ram_block_by_name(id);
-    if (block && block->max_length > offset) {
-        return block->host + offset;
+    if (!block) {
+        error_report("Can't find block %s", id);
+        return NULL;
     }
 
-    error_report("Can't find block %s", id);
-    return NULL;
+    return block;
+}
+
+static inline void *host_from_ram_block_offset(RAMBlock *block,
+                                               ram_addr_t offset)
+{
+    if (!offset_in_ramblock(block, offset)) {
+        return NULL;
+    }
+
+    return block->host + offset;
 }
 
 /*
@@ -2302,7 +2308,9 @@ static int ram_load_postcopy(QEMUFile *f)
         trace_ram_load_postcopy_loop((uint64_t)addr, flags);
         place_needed = false;
         if (flags & (RAM_SAVE_FLAG_COMPRESS | RAM_SAVE_FLAG_PAGE)) {
-            host = host_from_stream_offset(f, addr, flags);
+            RAMBlock *block = ram_block_from_stream(f, flags);
+
+            host = host_from_ram_block_offset(block, addr);
             if (!host) {
                 error_report("Illegal RAM offset " RAM_ADDR_FMT, addr);
                 ret = -EINVAL;
@@ -2433,7 +2441,9 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
 
         if (flags & (RAM_SAVE_FLAG_COMPRESS | RAM_SAVE_FLAG_PAGE |
                      RAM_SAVE_FLAG_COMPRESS_PAGE | RAM_SAVE_FLAG_XBZRLE)) {
-            host = host_from_stream_offset(f, addr, flags);
+            RAMBlock *block = ram_block_from_stream(f, flags);
+
+            host = host_from_ram_block_offset(block, addr);
             if (!host) {
                 error_report("Illegal RAM offset " RAM_ADDR_FMT, addr);
                 ret = -EINVAL;
Signature · 1 line
2.5.0
author
#2 lore raw

[Qemu-devel] [PULL 2/9] migration: rename 'file' in MigrationState to 'to_dst_file'

In reply to Amit Shah

From: zhanghailiang <[email protected]>

Rename the 'file' member of MigrationState to 'to_dst_file' to be consistent with to_src_file, from_src_file and from_dst_file.

Message-Id: <[email protected]>

---
 include/migration/migration.h |  2 +-
 migration/exec.c              |  4 +--
 migration/fd.c                |  4 +--
 migration/migration.c         | 72 ++++++++++++++++++++++---------------------
 migration/postcopy-ram.c      |  6 ++--
 migration/rdma.c              |  2 +-
 migration/savevm.c            |  2 +-
 migration/tcp.c               |  4 +--
 migration/unix.c              |  4 +--
 9 files changed, 52 insertions(+), 48 deletions(-)
include/migration/migration.h +1 -1
index 0fc1ffa..74684ad 100644
@@ -133,7 +133,7 @@ struct MigrationState
     size_t xfer_limit;
     QemuThread thread;
     QEMUBH *cleanup_bh;
-    QEMUFile *file;
+    QEMUFile *to_dst_file;
     int parameters[MIGRATION_PARAMETER__MAX];
 
     int state;
migration/exec.c +2 -2
index f1b5e47..62f892d 100644
@@ -36,8 +36,8 @@
 
 void exec_start_outgoing_migration(MigrationState *s, const char *command, Error **errp)
 {
-    s->file = qemu_popen_cmd(command, "w");
-    if (s->file == NULL) {
+    s->to_dst_file = qemu_popen_cmd(command, "w");
+    if (s->to_dst_file == NULL) {
         error_setg_errno(errp, errno, "failed to popen the migration target");
         return;
     }
migration/fd.c +2 -2
index c0afc96..085dd7c 100644
@@ -51,9 +51,9 @@ void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **
     }
 
     if (fd_is_socket(fd)) {
-        s->file = qemu_fopen_socket(fd, "wb");
+        s->to_dst_file = qemu_fopen_socket(fd, "wb");
     } else {
-        s->file = qemu_fdopen(fd, "wb");
+        s->to_dst_file = qemu_fdopen(fd, "wb");
     }
 
     migrate_fd_connect(s);
migration/migration.c +37 -35

229 lines not on this page · raw message

migration/postcopy-ram.c +4 -2
index 02b28ed..254c629 100644
@@ -725,7 +725,8 @@ void postcopy_discard_send_range(MigrationState *ms, PostcopyDiscardState *pds,
 
     if (pds->cur_entry == MAX_DISCARDS_PER_COMMAND) {
         /* Full set, ship it! */
-        qemu_savevm_send_postcopy_ram_discard(ms->file, pds->ramblock_name,
+        qemu_savevm_send_postcopy_ram_discard(ms->to_dst_file,
+                                              pds->ramblock_name,
                                               pds->cur_entry,
                                               pds->start_list,
                                               pds->length_list);
@@ -745,7 +746,8 @@ void postcopy_discard_send_finish(MigrationState *ms, PostcopyDiscardState *pds)
 {
     /* Anything unsent? */
     if (pds->cur_entry) {
-        qemu_savevm_send_postcopy_ram_discard(ms->file, pds->ramblock_name,
+        qemu_savevm_send_postcopy_ram_discard(ms->to_dst_file,
+                                              pds->ramblock_name,
                                               pds->cur_entry,
                                               pds->start_list,
                                               pds->length_list);
migration/rdma.c +1 -1
index 86a13b8..bcae1e8 100644
@@ -3504,7 +3504,7 @@ void rdma_start_outgoing_migration(void *opaque,
 
     trace_rdma_start_outgoing_migration_after_rdma_connect();
 
-    s->file = qemu_fopen_rdma(rdma, "wb");
+    s->to_dst_file = qemu_fopen_rdma(rdma, "wb");
     migrate_fd_connect(s);
     return;
 err:
migration/savevm.c +1 -1
index 954988d..8a2cddc 100644
@@ -1163,7 +1163,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
         .shared = 0
     };
     MigrationState *ms = migrate_init(&params);
-    ms->file = f;
+    ms->to_dst_file = f;
 
     if (qemu_savevm_state_blocked(errp)) {
         return -EINVAL;
migration/tcp.c +2 -2
index ae80e94..e888a4e 100644
@@ -39,11 +39,11 @@ static void tcp_wait_for_connect(int fd, Error *err, void *opaque)
 
     if (fd < 0) {
         DPRINTF("migrate connect error: %s\n", error_get_pretty(err));
-        s->file = NULL;
+        s->to_dst_file = NULL;
         migrate_fd_error(s);
     } else {
         DPRINTF("migrate connect success\n");
-        s->file = qemu_fopen_socket(fd, "wb");
+        s->to_dst_file = qemu_fopen_socket(fd, "wb");
         migrate_fd_connect(s);
     }
 }
migration/unix.c +2 -2
index a721c4a..d9aac36 100644
@@ -39,11 +39,11 @@ static void unix_wait_for_connect(int fd, Error *err, void *opaque)
 
     if (fd < 0) {
         DPRINTF("migrate connect error: %s\n", error_get_pretty(err));
-        s->file = NULL;
+        s->to_dst_file = NULL;
         migrate_fd_error(s);
     } else {
         DPRINTF("migrate connect success\n");
-        s->file = qemu_fopen_socket(fd, "wb");
+        s->to_dst_file = qemu_fopen_socket(fd, "wb");
         migrate_fd_connect(s);
     }
 }
Signature · 1 line
2.5.0
author
#3 lore raw

[Qemu-devel] [PULL 3/9] savevm: Split load vm state function qemu_loadvm_state

In reply to Amit Shah

From: zhanghailiang <[email protected]>

qemu_loadvm_state is too long, and we can simplify it by splitting up with three helper functions.

Message-Id: <[email protected]>

---
 migration/savevm.c | 156 +++++++++++++++++++++++++++++++----------------------
 1 file changed, 92 insertions(+), 64 deletions(-)
migration/savevm.c +92 -64
index 8a2cddc..00be5fe 100644
@@ -1718,90 +1718,118 @@ void loadvm_free_handlers(MigrationIncomingState *mis)
     }
 }
 
+static int
+qemu_loadvm_section_start_full(QEMUFile *f, MigrationIncomingState *mis)
+{
+    uint32_t instance_id, version_id, section_id;
+    SaveStateEntry *se;
+    LoadStateEntry *le;
+    char idstr[256];
+    int ret;
+
+    /* Read section start */
+    section_id = qemu_get_be32(f);
+    if (!qemu_get_counted_string(f, idstr)) {
+        error_report("Unable to read ID string for section %u",
+                     section_id);
+        return -EINVAL;
+    }
+    instance_id = qemu_get_be32(f);
+    version_id = qemu_get_be32(f);
+
+    trace_qemu_loadvm_state_section_startfull(section_id, idstr,
+            instance_id, version_id);
+    /* Find savevm section */
+    se = find_se(idstr, instance_id);
+    if (se == NULL) {
+        error_report("Unknown savevm section or instance '%s' %d",
+                     idstr, instance_id);
+        return -EINVAL;
+    }
+
+    /* Validate version */
+    if (version_id > se->version_id) {
+        error_report("savevm: unsupported version %d for '%s' v%d",
+                     version_id, idstr, se->version_id);
+        return -EINVAL;
+    }
+
+    /* Add entry */
+    le = g_malloc0(sizeof(*le));
+
+    le->se = se;
+    le->section_id = section_id;
+    le->version_id = version_id;
+    QLIST_INSERT_HEAD(&mis->loadvm_handlers, le, entry);
+
+    ret = vmstate_load(f, le->se, le->version_id);
+    if (ret < 0) {
+        error_report("error while loading state for instance 0x%x of"
+                     " device '%s'", instance_id, idstr);
+        return ret;
+    }
+    if (!check_section_footer(f, le)) {
+        return -EINVAL;
+    }
+
+    return 0;
+}
+
+static int
+qemu_loadvm_section_part_end(QEMUFile *f, MigrationIncomingState *mis)
+{
+    uint32_t section_id;
+    LoadStateEntry *le;
+    int ret;
+
+    section_id = qemu_get_be32(f);
+
+    trace_qemu_loadvm_state_section_partend(section_id);
+    QLIST_FOREACH(le, &mis->loadvm_handlers, entry) {
+        if (le->section_id == section_id) {
+            break;
+        }
+    }
+    if (le == NULL) {
+        error_report("Unknown savevm section %d", section_id);
+        return -EINVAL;
+    }
+
+    ret = vmstate_load(f, le->se, le->version_id);
+    if (ret < 0) {
+        error_report("error while loading state section id %d(%s)",
+                     section_id, le->se->idstr);
+        return ret;
+    }
+    if (!check_section_footer(f, le)) {
+        return -EINVAL;
+    }
+
+    return 0;
+}
+
 static int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis)
 {
     uint8_t section_type;
     int ret;
 
     while ((section_type = qemu_get_byte(f)) != QEMU_VM_EOF) {
-        uint32_t instance_id, version_id, section_id;
-        SaveStateEntry *se;
-        LoadStateEntry *le;
-        char idstr[256];
 
         trace_qemu_loadvm_state_section(section_type);
         switch (section_type) {
         case QEMU_VM_SECTION_START:
         case QEMU_VM_SECTION_FULL:
-            /* Read section start */
-            section_id = qemu_get_be32(f);
-            if (!qemu_get_counted_string(f, idstr)) {
-                error_report("Unable to read ID string for section %u",
-                            section_id);
-                return -EINVAL;
-            }
-            instance_id = qemu_get_be32(f);
-            version_id = qemu_get_be32(f);
-
-            trace_qemu_loadvm_state_section_startfull(section_id, idstr,
-                                                      instance_id, version_id);
-            /* Find savevm section */
-            se = find_se(idstr, instance_id);
-            if (se == NULL) {
-                error_report("Unknown savevm section or instance '%s' %d",
-                             idstr, instance_id);
-                return -EINVAL;
-            }
-
-            /* Validate version */
-            if (version_id > se->version_id) {
-                error_report("savevm: unsupported version %d for '%s' v%d",
-                             version_id, idstr, se->version_id);
-                return -EINVAL;
-            }
-
-            /* Add entry */
-            le = g_malloc0(sizeof(*le));
-
-            le->se = se;
-            le->section_id = section_id;
-            le->version_id = version_id;
-            QLIST_INSERT_HEAD(&mis->loadvm_handlers, le, entry);
-
-            ret = vmstate_load(f, le->se, le->version_id);
+            ret = qemu_loadvm_section_start_full(f, mis);
             if (ret < 0) {
-                error_report("error while loading state for instance 0x%x of"
-                             " device '%s'", instance_id, idstr);
                 return ret;
             }
-            if (!check_section_footer(f, le)) {
-                return -EINVAL;
-            }
             break;
         case QEMU_VM_SECTION_PART:
         case QEMU_VM_SECTION_END:
-            section_id = qemu_get_be32(f);
-
-            trace_qemu_loadvm_state_section_partend(section_id);
-            QLIST_FOREACH(le, &mis->loadvm_handlers, entry) {
-                if (le->section_id == section_id) {
-                    break;
-                }
-            }
-            if (le == NULL) {
-                error_report("Unknown savevm section %d", section_id);
-                return -EINVAL;
-            }
-
-            ret = vmstate_load(f, le->se, le->version_id);
+            ret = qemu_loadvm_section_part_end(f, mis);
             if (ret < 0) {
-                error_report("error while loading state section id %d(%s)",
-                             section_id, le->se->idstr);
                 return ret;
             }
-            if (!check_section_footer(f, le)) {
-                return -EINVAL;
-            }
             break;
         case QEMU_VM_COMMAND:
             ret = loadvm_process_command(f);
Signature · 1 line
2.5.0
author
#4 lore raw

[Qemu-devel] [PULL 4/9] migration/ram: Fix some helper functions' parameter to use PageSearchStatus

In reply to Amit Shah

From: zhanghailiang <[email protected]>

Some helper functions use parameters 'RAMBlock *block' and 'ram_addr_t *offset', We can use 'PageSearchStatus *pss' directly instead, with this change, we can reduce the number of parameters for these helper function, also it is easily to add new parameters for these helper functions.

Message-Id: <[email protected]>

---
 migration/ram.c | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)
migration/ram.c +19 -14
index b541ceb..3cdfea4 100644
@@ -729,7 +729,7 @@ static int save_zero_page(QEMUFile *f, RAMBlock *block, ram_addr_t offset,
  * @last_stage: if we are at the completion stage
  * @bytes_transferred: increase it with the number of transferred bytes
  */
-static int ram_save_page(QEMUFile *f, RAMBlock* block, ram_addr_t offset,
+static int ram_save_page(QEMUFile *f, PageSearchStatus *pss,
                          bool last_stage, uint64_t *bytes_transferred)
 {
     int pages = -1;
@@ -738,6 +738,8 @@ static int ram_save_page(QEMUFile *f, RAMBlock* block, ram_addr_t offset,
     uint8_t *p;
     int ret;
     bool send_async = true;
+    RAMBlock *block = pss->block;
+    ram_addr_t offset = pss->offset;
 
     p = block->host + offset;
 
@@ -912,14 +914,16 @@ static int compress_page_with_multi_thread(QEMUFile *f, RAMBlock *block,
  * @last_stage: if we are at the completion stage
  * @bytes_transferred: increase it with the number of transferred bytes
  */
-static int ram_save_compressed_page(QEMUFile *f, RAMBlock *block,
-                                    ram_addr_t offset, bool last_stage,
+static int ram_save_compressed_page(QEMUFile *f, PageSearchStatus *pss,
+                                    bool last_stage,
                                     uint64_t *bytes_transferred)
 {
     int pages = -1;
     uint64_t bytes_xmit;
     uint8_t *p;
     int ret;
+    RAMBlock *block = pss->block;
+    ram_addr_t offset = pss->offset;
 
     p = block->host + offset;
 
@@ -1229,7 +1233,7 @@ err:
  * Returns: Number of pages written.
  */
 static int ram_save_target_page(MigrationState *ms, QEMUFile *f,
-                                RAMBlock *block, ram_addr_t offset,
+                                PageSearchStatus *pss,
                                 bool last_stage,
                                 uint64_t *bytes_transferred,
                                 ram_addr_t dirty_ram_abs)
@@ -1240,11 +1244,11 @@ static int ram_save_target_page(MigrationState *ms, QEMUFile *f,
     if (migration_bitmap_clear_dirty(dirty_ram_abs)) {
         unsigned long *unsentmap;
         if (compression_switch && migrate_use_compression()) {
-            res = ram_save_compressed_page(f, block, offset,
+            res = ram_save_compressed_page(f, pss,
                                            last_stage,
                                            bytes_transferred);
         } else {
-            res = ram_save_page(f, block, offset, last_stage,
+            res = ram_save_page(f, pss, last_stage,
                                 bytes_transferred);
         }
 
@@ -1260,7 +1264,7 @@ static int ram_save_target_page(MigrationState *ms, QEMUFile *f,
          * to the stream.
          */
         if (res > 0) {
-            last_sent_block = block;
+            last_sent_block = pss->block;
         }
     }
 
@@ -1284,26 +1288,27 @@ static int ram_save_target_page(MigrationState *ms, QEMUFile *f,
  * @bytes_transferred: increase it with the number of transferred bytes
  * @dirty_ram_abs: Address of the start of the dirty page in ram_addr_t space
  */
-static int ram_save_host_page(MigrationState *ms, QEMUFile *f, RAMBlock *block,
-                              ram_addr_t *offset, bool last_stage,
+static int ram_save_host_page(MigrationState *ms, QEMUFile *f,
+                              PageSearchStatus *pss,
+                              bool last_stage,
                               uint64_t *bytes_transferred,
                               ram_addr_t dirty_ram_abs)
 {
     int tmppages, pages = 0;
     do {
-        tmppages = ram_save_target_page(ms, f, block, *offset, last_stage,
+        tmppages = ram_save_target_page(ms, f, pss, last_stage,
                                         bytes_transferred, dirty_ram_abs);
         if (tmppages < 0) {
             return tmppages;
         }
 
         pages += tmppages;
-        *offset += TARGET_PAGE_SIZE;
+        pss->offset += TARGET_PAGE_SIZE;
         dirty_ram_abs += TARGET_PAGE_SIZE;
-    } while (*offset & (qemu_host_page_size - 1));
+    } while (pss->offset & (qemu_host_page_size - 1));
 
     /* The offset we leave with is the last one we looked at */
-    *offset -= TARGET_PAGE_SIZE;
+    pss->offset -= TARGET_PAGE_SIZE;
     return pages;
 }
 
@@ -1351,7 +1356,7 @@ static int ram_find_and_save_block(QEMUFile *f, bool last_stage,
         }
 
         if (found) {
-            pages = ram_save_host_page(ms, f, pss.block, &pss.offset,
+            pages = ram_save_host_page(ms, f, &pss,
                                        last_stage, bytes_transferred,
                                        dirty_ram_abs);
         }
Signature · 1 line
2.5.0
author
#5 lore raw

[Qemu-devel] [PULL 6/9] qmp-commands.hx: Document the missing options for migration capability commands

In reply to Amit Shah

From: zhanghailiang <[email protected]>

Add the missing descriptions for the options of migration capability commands, and fix the example for query-migrate-capabilities command.

Message-Id: <[email protected]>

[Amit: Strip whitespace]
---
 qmp-commands.hx | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
qmp-commands.hx +14 -1
index b25b97c..020e5ee 100644
@@ -3647,7 +3647,9 @@ Enable/Disable migration capabilities
 - "rdma-pin-all": pin all pages when using RDMA during migration
 - "auto-converge": throttle down guest to help convergence of migration
 - "zero-blocks": compress zero blocks during block migration
+- "compress": use multiple compression threads to accelerate live migration
 - "events": generate events for each migration state change
+- "x-postcopy-ram": postcopy mode for live migration
 
 Arguments:
 
@@ -3675,13 +3677,24 @@ Query current migration capabilities
          - "rdma-pin-all" : RDMA Pin Page state (json-bool)
          - "auto-converge" : Auto Converge state (json-bool)
          - "zero-blocks" : Zero Blocks state (json-bool)
+         - "compress": Multiple compression threads state (json-bool)
+         - "events": Migration state change event state (json-bool)
+         - "x-postcopy-ram": postcopy ram state (json-bool)
 
 Arguments:
 
 Example:
 
 -> { "execute": "query-migrate-capabilities" }
-<- { "return": [ { "state": false, "capability": "xbzrle" } ] }
+<- {"return": [
+     {"state": false, "capability": "xbzrle"},
+     {"state": false, "capability": "rdma-pin-all"},
+     {"state": false, "capability": "auto-converge"},
+     {"state": false, "capability": "zero-blocks"},
+     {"state": false, "capability": "compress"},
+     {"state": true, "capability": "events"},
+     {"state": false, "capability": "x-postcopy-ram"}
+   ]}
 
 EQMP
 
Signature · 1 line
2.5.0
author
#6 lore raw

[Qemu-devel] [PULL 5/9] qmp-commands.hx: Fix the missing options for migration parameters commands

In reply to Amit Shah

From: zhanghailiang <[email protected]>

We didn't document x-cpu-throttle-initial/x-cpu-throttle-increment for commands migrate-set-parameters and query-migrate-parameters.

Here we add the descriptions for these two options and fix the wrong example for query-migrate-parameters qmp commands.
Besides, this will also fix the bug that we can't set x-cpu-throttle-initial and x-cpu-throttle-increment through migrate-set-parameters qmp command.

Message-Id: <[email protected]>

[Amit: fix typo in 'auto-converge']
---
 qmp-commands.hx | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
qmp-commands.hx +14 -4
index db072a6..b25b97c 100644
@@ -3700,6 +3700,10 @@ Set migration parameters
 - "compress-level": set compression level during migration (json-int)
 - "compress-threads": set compression thread count for migration (json-int)
 - "decompress-threads": set decompression thread count for migration (json-int)
+- "x-cpu-throttle-initial": set initial percentage of time guest cpus are
+                           throttled for auto-converge (json-int)
+- "x-cpu-throttle-increment": set throttle increasing percentage for
+                             auto-converge (json-int)
 
 Arguments:
 
@@ -3713,7 +3717,7 @@ EQMP
     {
         .name       = "migrate-set-parameters",
         .args_type  =
-            "compress-level:i?,compress-threads:i?,decompress-threads:i?",
+            "compress-level:i?,compress-threads:i?,decompress-threads:i?,x-cpu-throttle-initial:i?,x-cpu-throttle-increment:i?",
         .mhandler.cmd_new = qmp_marshal_migrate_set_parameters,
     },
 SQMP
@@ -3726,6 +3730,10 @@ Query current migration parameters
          - "compress-level" : compression level value (json-int)
          - "compress-threads" : compression thread count value (json-int)
          - "decompress-threads" : decompression thread count value (json-int)
+         - "x-cpu-throttle-initial" : initial percentage of time guest cpus are
+                                      throttled (json-int)
+         - "x-cpu-throttle-increment" : throttle increasing percentage for
+                                        auto-converge (json-int)
 
 Arguments:
 
@@ -3734,9 +3742,11 @@ Example:
 -> { "execute": "query-migrate-parameters" }
 <- {
       "return": {
-         "decompress-threads", 2,
-         "compress-threads", 8,
-         "compress-level", 1
+         "decompress-threads": 2,
+         "x-cpu-throttle-increment": 10,
+         "compress-threads": 8,
+         "compress-level": 1,
+         "x-cpu-throttle-initial": 20
       }
    }
 
Signature · 1 line
2.5.0
author
#7 lore raw

[Qemu-devel] [PULL 7/9] migration: remove useless code.

In reply to Amit Shah

From: Liang Li <[email protected]>

Since 's->state' will be set in migrate_init(), there is no need to set it before calling migrate_init(). The code and the related comments can be removed.

Message-Id: <[email protected]>

---
 migration/migration.c | 6 ------
 1 file changed, 6 deletions(-)
migration/migration.c +0 -6
index 4971722..82604d2 100644
@@ -1007,12 +1007,6 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
         return;
     }
 
-    /* We are starting a new migration, so we want to start in a clean
-       state.  This change is only needed if previous migration
-       failed/was cancelled.  We don't use migrate_set_state() because
-       we are setting the initial state, not changing it. */
-    s->state = MIGRATION_STATUS_NONE;
-
     s = migrate_init(&params);
 
     if (strstart(uri, "tcp:", &p)) {
Signature · 1 line
2.5.0
author
#8 lore raw

[Qemu-devel] [PULL 8/9] static checker: e1000-82540em got aliased to e1000

In reply to Amit Shah

Commit 8304402033e8dbe8e379017d51ed1dd8344f1dce changed the name of the e1000-82540em device to e1000. This was flagged:

Section "e1000-82540em" does not exist in dest

Add the mapping to the changed section names dictionary so the checker can proceed.

Message-Id: <7ccfe834c897142dceaa4da87c13b7059fa12aa8.1450416947.git.amit.shah@redhat.com>

---
 scripts/vmstate-static-checker.py | 1 +
 1 file changed, 1 insertion(+)
scripts/vmstate-static-checker.py +1 -0
index b6c0bbe..b5ecaf6 100755
@@ -99,6 +99,7 @@ def get_changed_sec_name(sec):
     # Section names can change -- see commit 292b1634 for an example.
     changes = {
         "ICH9 LPC": "ICH9-LPC",
+        "e1000-82540em": "e1000",
     }
 
     for item in changes:
Signature · 1 line
2.5.0
author
#17 lore raw

[Qemu-devel] [PULL 9/9] migration: fix bad string passed to error_report()

In reply to Amit Shah

From: Greg Kurz <[email protected]>

state->name does not contain a terminating '\0' and you may get:

Machine type received is 'pseries-2.3y�?' and local is 'pseries-2.4' load of migration failed: Invalid argument

Let's add a precision modifier to fix this.

Message-Id: <[email protected]>

---
 migration/savevm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
migration/savevm.c +2 -2
index 00be5fe..94f2894 100644
@@ -299,8 +299,8 @@ static int configuration_post_load(void *opaque, int version_id)
     const char *current_name = MACHINE_GET_CLASS(current_machine)->name;
 
     if (strncmp(state->name, current_name, state->len) != 0) {
-        error_report("Machine type received is '%s' and local is '%s'",
-                     state->name, current_name);
+        error_report("Machine type received is '%.*s' and local is '%s'",
+                     (int) state->len, state->name, current_name);
         return -EINVAL;
     }
     return 0;
Signature · 1 line
2.5.0
#18 lore raw
In reply to Amit Shah
Quoted 10 lines · Amit Shah

The following changes since commit d38ea87ac54af64ef611de434d07c12dc0399216:

all: Clean up includes (2016-02-04 17:41:30 +0000)

are available in the git repository at:

https://git.kernel.org/pub/scm/virt/qemu/amit/migration.git tags/migration-for-2.6-2

for you to fetch changes up to 15d61692da651fc79b3fc40050b986c5a73055c0:

Quoted 9 lines

migration: fix bad string passed to error_report() (2016-02-05 19:09:51 +0530)

----------------------------------------------------------------
Migration pull req.

Small fixes, nothing major.

----------------------------------------------------------------

Applied, thanks.

-- PMM

#9 lore raw

Re: [Qemu-devel] [PULL 8/9] static checker: e1000-82540em got aliased to e1000

In reply to Amit Shah
Quoted 22 lines · Amit Shah

Commit 8304402033e8dbe8e379017d51ed1dd8344f1dce changed the name of the e1000-82540em device to e1000. This was flagged:

Section "e1000-82540em" does not exist in dest

Add the mapping to the changed section names dictionary so the checker can proceed.

Message-Id: <7ccfe834c897142dceaa4da87c13b7059fa12aa8.1450416947.git.amit.shah@redhat.com>

---
 scripts/vmstate-static-checker.py | 1 +
 1 file changed, 1 insertion(+)
scripts/vmstate-static-checker.py +0 -0
index b6c0bbe..b5ecaf6 100755

scripts/vmstate-static-checker.py def get_changed_sec_name(sec): · line 105

Quoted 7 lines
scripts/vmstate-static-checker.py +1 -0
@@ -99,6 +99,7 @@ def get_changed_sec_name(sec):
     # Section names can change -- see commit 292b1634 for an example.
     changes = {
         "ICH9 LPC": "ICH9-LPC",
+        "e1000-82540em": "e1000",
     }
 
     for item in changes:

This means that 2.5 cannot migrate 2.4 virtual machines, right? Is that something we want to rectify in 2.6 by making e1000-82540em an alias of e1000 (instead of the other way round)?

Paolo

author
#10 lore raw

Re: [Qemu-devel] [PULL 8/9] static checker: e1000-82540em got aliased to e1000

Quoted 30 lines · Paolo Bonzini
Quoted 27 lines · Amit Shah

Commit 8304402033e8dbe8e379017d51ed1dd8344f1dce changed the name of the e1000-82540em device to e1000. This was flagged:

Section "e1000-82540em" does not exist in dest

Add the mapping to the changed section names dictionary so the checker can proceed.

Message-Id: <7ccfe834c897142dceaa4da87c13b7059fa12aa8.1450416947.git.amit.shah@redhat.com>

---
 scripts/vmstate-static-checker.py | 1 +
 1 file changed, 1 insertion(+)
scripts/vmstate-static-checker.py +1 -0
index b6c0bbe..b5ecaf6 100755
@@ -99,6 +99,7 @@ def get_changed_sec_name(sec):
     # Section names can change -- see commit 292b1634 for an example.
     changes = {
         "ICH9 LPC": "ICH9-LPC",
+        "e1000-82540em": "e1000",
     }
 
Quoted 6 lines

scripts/vmstate-static-checker.py def get_changed_sec_name(sec): · line 105

Quoted 2 lines
scripts/vmstate-static-checker.py +0 -0
     for item in changes:

This means that 2.5 cannot migrate 2.4 virtual machines, right? Is that something we want to rectify in 2.6 by making e1000-82540em an alias of e1000 (instead of the other way round)?

You're right; I misread it. With that commit (8304402033):

2.4 with e1000-82540em will not migrate to 2.5 with e1000-82540em.

This is despite they're aliased (so the cmdline is backward compatible), but the migration device name actually changed.

Of course, 2.5->2.4 will also not work.

Since 2.4 emits 'e1000-82540em' as the device name in the migration stream, and 2.5 emits just 'e1000', we have two different names for the same device in two versions.

To fix this, we'll need a hack on the dest side to allow e1000 and e1000-82540em in the migration stream for the device, and this can be done for 2.6 and 2.5.stable.

Jason, can you attempt this?

Amit

#11 lore raw

Re: [Qemu-devel] [PULL 8/9] static checker: e1000-82540em got aliased to e1000

Quoted 48 lines · Amit Shah
Quoted 29 lines · Paolo Bonzini
Quoted 27 lines · Amit Shah

Commit 8304402033e8dbe8e379017d51ed1dd8344f1dce changed the name of the e1000-82540em device to e1000. This was flagged:

Section "e1000-82540em" does not exist in dest

Add the mapping to the changed section names dictionary so the checker can proceed.

Message-Id: <7ccfe834c897142dceaa4da87c13b7059fa12aa8.1450416947.git.amit.shah@redhat.com>

---
 scripts/vmstate-static-checker.py | 1 +
 1 file changed, 1 insertion(+)
scripts/vmstate-static-checker.py +1 -0
index b6c0bbe..b5ecaf6 100755
@@ -99,6 +99,7 @@ def get_changed_sec_name(sec):
     # Section names can change -- see commit 292b1634 for an example.
     changes = {
         "ICH9 LPC": "ICH9-LPC",
+        "e1000-82540em": "e1000",
     }
 
Quoted 5 lines

scripts/vmstate-static-checker.py def get_changed_sec_name(sec): · line 105

Quoted 2 lines
scripts/vmstate-static-checker.py +0 -0
     for item in changes:

This means that 2.5 cannot migrate 2.4 virtual machines, right? Is that something we want to rectify in 2.6 by making e1000-82540em an alias of e1000 (instead of the other way round)?

You're right; I misread it. With that commit (8304402033):

2.4 with e1000-82540em will not migrate to 2.5 with e1000-82540em.

This is despite they're aliased (so the cmdline is backward compatible), but the migration device name actually changed.

Of course, 2.5->2.4 will also not work.

Since 2.4 emits 'e1000-82540em' as the device name in the migration stream, and 2.5 emits just 'e1000', we have two different names for the same device in two versions.

Quoted 8 lines

To fix this, we'll need a hack on the dest side to allow e1000 and e1000-82540em in the migration stream for the device, and this can be done for 2.6 and 2.5.stable.

Jason, can you attempt this?

Amit

Sure, but just need to understand the "problem". If I understand this correctly, the issue only happen for JSON description at the end of migration stream, and it won't break migration in fact?

author
#12 lore raw

Re: [Qemu-devel] [PULL 8/9] static checker: e1000-82540em got aliased to e1000

Quoted 20 lines · Jason Wang
Quoted 20 lines
Quoted 3 lines

This means that 2.5 cannot migrate 2.4 virtual machines, right? Is that something we want to rectify in 2.6 by making e1000-82540em an alias of e1000 (instead of the other way round)?

You're right; I misread it. With that commit (8304402033):

2.4 with e1000-82540em will not migrate to 2.5 with e1000-82540em.

This is despite they're aliased (so the cmdline is backward compatible), but the migration device name actually changed.

Of course, 2.5->2.4 will also not work.

Since 2.4 emits 'e1000-82540em' as the device name in the migration stream, and 2.5 emits just 'e1000', we have two different names for the same device in two versions.

To fix this, we'll need a hack on the dest side to allow e1000 and e1000-82540em in the migration stream for the device, and this can be done for 2.6 and 2.5.stable.

Quoted 5 lines
Quoted 2 lines

Jason, can you attempt this?

Sure, but just need to understand the "problem". If I understand this correctly, the issue only happen for JSON description at the end of migration stream, and it won't break migration in fact?

No, this does break migration.

The stream contained 'e1000-82540em' as the section header for the device earlier. It now only has 'e1000'. So a newer qemu will only accept 'e1000', but not 'e1000-82540em' (from an older release).

Amit

#13 lore raw

Re: [Qemu-devel] [PULL 8/9] static checker: e1000-82540em got aliased to e1000

Quoted 27 lines · * Amit Shah ([email protected]) wrote:
Quoted 20 lines · Jason Wang
Quoted 20 lines
Quoted 3 lines

This means that 2.5 cannot migrate 2.4 virtual machines, right? Is that something we want to rectify in 2.6 by making e1000-82540em an alias of e1000 (instead of the other way round)?

You're right; I misread it. With that commit (8304402033):

2.4 with e1000-82540em will not migrate to 2.5 with e1000-82540em.

This is despite they're aliased (so the cmdline is backward compatible), but the migration device name actually changed.

Of course, 2.5->2.4 will also not work.

Since 2.4 emits 'e1000-82540em' as the device name in the migration stream, and 2.5 emits just 'e1000', we have two different names for the same device in two versions.

To fix this, we'll need a hack on the dest side to allow e1000 and e1000-82540em in the migration stream for the device, and this can be done for 2.6 and 2.5.stable.

Quoted 5 lines
Quoted 2 lines

Jason, can you attempt this?

Sure, but just need to understand the "problem". If I understand this correctly, the issue only happen for JSON description at the end of migration stream, and it won't break migration in fact?

Quoted 5 lines

No, this does break migration.

The stream contained 'e1000-82540em' as the section header for the device earlier. It now only has 'e1000'. So a newer qemu will only accept 'e1000', but not 'e1000-82540em' (from an older release).

OK, so do we need to get this fixed for 2.6 - i.e. now.

Dave

Quoted 2 lines

Amit

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#14 lore raw

Re: [Qemu-devel] [PULL 8/9] static checker: e1000-82540em got aliased to e1000

Quoted 27 lines · Dr. David Alan Gilbert
Quoted 26 lines · * Amit Shah ([email protected]) wrote:
Quoted 25 lines · Jason Wang
Quoted 16 lines
Quoted 3 lines

This means that 2.5 cannot migrate 2.4 virtual machines, right? Is that something we want to rectify in 2.6 by making e1000-82540em an alias of e1000 (instead of the other way round)?

You're right; I misread it. With that commit (8304402033):

2.4 with e1000-82540em will not migrate to 2.5 with e1000-82540em.

This is despite they're aliased (so the cmdline is backward compatible), but the migration device name actually changed.

Of course, 2.5->2.4 will also not work.

Since 2.4 emits 'e1000-82540em' as the device name in the migration stream, and 2.5 emits just 'e1000', we have two different names for the same device in two versions.

Quoted 6 lines

To fix this, we'll need a hack on the dest side to allow e1000 and e1000-82540em in the migration stream for the device, and this can be done for 2.6 and 2.5.stable.

Jason, can you attempt this?

Sure, but just need to understand the "problem". If I understand this correctly, the issue only happen for JSON description at the end of migration stream, and it won't break migration in fact?

Quoted 8 lines
Quoted 5 lines

No, this does break migration.

The stream contained 'e1000-82540em' as the section header for the device earlier. It now only has 'e1000'. So a newer qemu will only accept 'e1000', but not 'e1000-82540em' (from an older release).

OK, so do we need to get this fixed for 2.6 - i.e. now.

Dave

Sorry for the late response.

Have a try with 2.4 -> 2.5 migration and it works. Looking at save_section_header(), it will save se->idstr which seems always be "e1000" even if e1000-82540em is used in cli, or is there anything I missed?

Quoted 4 lines
Quoted 2 lines

Amit

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

author
#15 lore raw

Re: [Qemu-devel] [PULL 8/9] static checker: e1000-82540em got aliased to e1000

Quoted 37 lines · Jason Wang
Quoted 34 lines · Dr. David Alan Gilbert
Quoted 23 lines · * Amit Shah ([email protected]) wrote:
Quoted 22 lines · Jason Wang
Quoted 22 lines
Quoted 3 lines

This means that 2.5 cannot migrate 2.4 virtual machines, right? Is that something we want to rectify in 2.6 by making e1000-82540em an alias of e1000 (instead of the other way round)?

You're right; I misread it. With that commit (8304402033):

2.4 with e1000-82540em will not migrate to 2.5 with e1000-82540em.

This is despite they're aliased (so the cmdline is backward compatible), but the migration device name actually changed.

Of course, 2.5->2.4 will also not work.

Since 2.4 emits 'e1000-82540em' as the device name in the migration stream, and 2.5 emits just 'e1000', we have two different names for the same device in two versions.

To fix this, we'll need a hack on the dest side to allow e1000 and e1000-82540em in the migration stream for the device, and this can be done for 2.6 and 2.5.stable.

Jason, can you attempt this?

Quoted 8 lines
Quoted 3 lines

Sure, but just need to understand the "problem". If I understand this correctly, the issue only happen for JSON description at the end of migration stream, and it won't break migration in fact?

No, this does break migration.

The stream contained 'e1000-82540em' as the section header for the device earlier. It now only has 'e1000'. So a newer qemu will only accept 'e1000', but not 'e1000-82540em' (from an older release).

OK, so do we need to get this fixed for 2.6 - i.e. now.

Quoted 7 lines
Quoted 1 line

Dave

Sorry for the late response.

Have a try with 2.4 -> 2.5 migration and it works. Looking at save_section_header(), it will save se->idstr which seems always be "e1000" even if e1000-82540em is used in cli, or is there anything I missed?

OK, sorry for the wrong alarm.

The VMStateDescription's 'name' field has remained the same; but the section name has changed, which is fine (that isn't transmitted over the wire). So my initial reading was correct - and the whitelist I added in 1483e0d74dcfd183ff46dd63cc57e1fe8b775bf8 is fine.

So nothing needed for the migration stream.

Thanks, Jason.

Amit

#16 lore raw

Re: [Qemu-devel] [PULL 8/9] static checker: e1000-82540em got aliased to e1000

Quoted 50 lines · Amit Shah
Quoted 34 lines · Jason Wang
Quoted 32 lines · Dr. David Alan Gilbert
Quoted 31 lines · * Amit Shah ([email protected]) wrote:
Quoted 20 lines · Jason Wang
Quoted 20 lines
Quoted 3 lines

This means that 2.5 cannot migrate 2.4 virtual machines, right? Is that something we want to rectify in 2.6 by making e1000-82540em an alias of e1000 (instead of the other way round)?

You're right; I misread it. With that commit (8304402033):

2.4 with e1000-82540em will not migrate to 2.5 with e1000-82540em.

This is despite they're aliased (so the cmdline is backward compatible), but the migration device name actually changed.

Of course, 2.5->2.4 will also not work.

Since 2.4 emits 'e1000-82540em' as the device name in the migration stream, and 2.5 emits just 'e1000', we have two different names for the same device in two versions.

To fix this, we'll need a hack on the dest side to allow e1000 and e1000-82540em in the migration stream for the device, and this can be done for 2.6 and 2.5.stable.

Quoted 5 lines
Quoted 2 lines

Jason, can you attempt this?

Sure, but just need to understand the "problem". If I understand this correctly, the issue only happen for JSON description at the end of migration stream, and it won't break migration in fact?

No, this does break migration.

The stream contained 'e1000-82540em' as the section header for the device earlier. It now only has 'e1000'. So a newer qemu will only accept 'e1000', but not 'e1000-82540em' (from an older release).

Quoted 8 lines
Quoted 3 lines

OK, so do we need to get this fixed for 2.6 - i.e. now.

Dave

Sorry for the late response.

Have a try with 2.4 -> 2.5 migration and it works. Looking at save_section_header(), it will save se->idstr which seems always be "e1000" even if e1000-82540em is used in cli, or is there anything I missed?

OK, sorry for the wrong alarm.

The VMStateDescription's 'name' field has remained the same; but the section name has changed, which is fine (that isn't transmitted over the wire). So my initial reading was correct - and the whitelist I added in 1483e0d74dcfd183ff46dd63cc57e1fe8b775bf8 is fine.

Quoted 6 lines

So nothing needed for the migration stream.

Thanks, Jason.

Amit

Thanks for the confirmation.