Commit 4378caf5 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20161014' into staging



migration/next for 20161014

# gpg: Signature made Fri 14 Oct 2016 16:24:13 BST
# gpg:                using RSA key 0xF487EF185872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"
# Primary key fingerprint: 1899 FF8E DEBF 58CC EE03  4B82 F487 EF18 5872 D723

* remotes/juanquintela/tags/migration/20161014:
  docs/xbzrle: correction
  migrate: move max-bandwidth and downtime-limit to migrate_set_parameter
  migration: Fix seg with missing port
  migration/postcopy: Explicitly disallow huge pages
  RAMBlocks: Store page size
  Postcopy vs xbzrle: Don't send xbzrle pages once in postcopy [for 2.8]
  migrate: Fix bounds check for migration parameters in migration.c
  migrate: Use boxed qapi for migrate-set-parameters
  migrate: Share common MigrationParameters struct
  migrate: Fix cpu-throttle-increment regression in HMP
  migration/rdma: Don't flag an error when we've been told about one
  migration: Make failed migration load set file error
  migration/rdma: Pass qemu_file errors across link
  migration: Report values for comparisons
  migration: report an error giving the failed field

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 6aa5a367 7c2b0f65
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -2910,7 +2910,9 @@ Set migration parameters
                          throttled for auto-converge (json-int)
- "cpu-throttle-increment": set throttle increasing percentage for
                            auto-converge (json-int)

- "max-bandwidth": set maximum speed for migrations (in bytes/sec) (json-int)
- "downtime-limit": set maximum tolerated downtime (in milliseconds) for
                    migrations (json-int)
Arguments:

Example:
@@ -2931,7 +2933,10 @@ Query current migration parameters
                                    throttled (json-int)
         - "cpu-throttle-increment" : throttle increasing percentage for
                                      auto-converge (json-int)

         - "max-bandwidth" : maximium migration speed in bytes per second
                             (json-int)
         - "downtime-limit" : maximum tolerated downtime of migration in
                              milliseconds (json-int)
Arguments:

Example:
@@ -2943,7 +2948,9 @@ Example:
         "cpu-throttle-increment": 10,
         "compress-threads": 8,
         "compress-level": 1,
         "cpu-throttle-initial": 20
         "cpu-throttle-initial": 20,
         "max-bandwidth": 33554432,
         "downtime-limit": 300
      }
   }

+2 −2
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ nzrun = length byte...
length = uleb128 encoded integer

On the sender side XBZRLE is used as a compact delta encoding of page updates,
retrieving the old page content from the cache (default size of 512 MB). The
retrieving the old page content from the cache (default size of 64MB). The
receiving side uses the existing page's content and XBZRLE to decode the new
page's content.

@@ -73,7 +73,7 @@ e9 07 0f 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 03 01 67 01 01 69

Cache update strategy
=====================
Keeping the hot pages in the cache is effective for decreased cache
Keeping the hot pages in the cache is effective for decreasing cache
misses. XBZRLE uses a counter as the age of each page. The counter will
increase after each ram dirty bitmap sync. When a cache conflict is
detected, XBZRLE will only evict pages in the cache that are older than
+12 −7
Original line number Diff line number Diff line
@@ -1199,7 +1199,6 @@ static void *file_ram_alloc(RAMBlock *block,
    char *c;
    void *area = MAP_FAILED;
    int fd = -1;
    int64_t page_size;

    if (kvm_enabled() && !kvm_has_sync_mmu()) {
        error_setg(errp,
@@ -1254,17 +1253,17 @@ static void *file_ram_alloc(RAMBlock *block,
         */
    }

    page_size = qemu_fd_getpagesize(fd);
    block->mr->align = MAX(page_size, QEMU_VMALLOC_ALIGN);
    block->page_size = qemu_fd_getpagesize(fd);
    block->mr->align = MAX(block->page_size, QEMU_VMALLOC_ALIGN);

    if (memory < page_size) {
    if (memory < block->page_size) {
        error_setg(errp, "memory size 0x" RAM_ADDR_FMT " must be equal to "
                   "or larger than page size 0x%" PRIx64,
                   memory, page_size);
                   "or larger than page size 0x%zx",
                   memory, block->page_size);
        goto error;
    }

    memory = ROUND_UP(memory, page_size);
    memory = ROUND_UP(memory, block->page_size);

    /*
     * ftruncate is not supported by hugetlbfs in older
@@ -1419,6 +1418,11 @@ void qemu_ram_unset_idstr(RAMBlock *block)
    }
}

size_t qemu_ram_pagesize(RAMBlock *rb)
{
    return rb->page_size;
}

static int memory_try_enable_merging(void *addr, size_t len)
{
    if (!machine_mem_merge(current_machine)) {
@@ -1658,6 +1662,7 @@ RAMBlock *qemu_ram_alloc_internal(ram_addr_t size, ram_addr_t max_size,
    new_block->max_length = max_size;
    assert(max_size >= size);
    new_block->fd = -1;
    new_block->page_size = getpagesize();
    new_block->host = host;
    if (host) {
        new_block->flags |= RAM_PREALLOC;
+53 −24
Original line number Diff line number Diff line
@@ -284,27 +284,40 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)

    if (params) {
        monitor_printf(mon, "parameters:");
        assert(params->has_compress_level);
        monitor_printf(mon, " %s: %" PRId64,
            MigrationParameter_lookup[MIGRATION_PARAMETER_COMPRESS_LEVEL],
            params->compress_level);
        assert(params->has_compress_threads);
        monitor_printf(mon, " %s: %" PRId64,
            MigrationParameter_lookup[MIGRATION_PARAMETER_COMPRESS_THREADS],
            params->compress_threads);
        assert(params->has_decompress_threads);
        monitor_printf(mon, " %s: %" PRId64,
            MigrationParameter_lookup[MIGRATION_PARAMETER_DECOMPRESS_THREADS],
            params->decompress_threads);
        assert(params->has_cpu_throttle_initial);
        monitor_printf(mon, " %s: %" PRId64,
            MigrationParameter_lookup[MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL],
            params->cpu_throttle_initial);
        assert(params->has_cpu_throttle_increment);
        monitor_printf(mon, " %s: %" PRId64,
            MigrationParameter_lookup[MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT],
            params->cpu_throttle_increment);
        monitor_printf(mon, " %s: '%s'",
            MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_CREDS],
            params->tls_creds ? : "");
            params->has_tls_creds ? params->tls_creds : "");
        monitor_printf(mon, " %s: '%s'",
            MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_HOSTNAME],
            params->tls_hostname ? : "");
            params->has_tls_hostname ? params->tls_hostname : "");
        assert(params->has_max_bandwidth);
        monitor_printf(mon, " %s: %" PRId64 " bytes/second",
            MigrationParameter_lookup[MIGRATION_PARAMETER_MAX_BANDWIDTH],
            params->max_bandwidth);
        assert(params->has_downtime_limit);
        monitor_printf(mon, " %s: %" PRId64 " milliseconds",
            MigrationParameter_lookup[MIGRATION_PARAMETER_DOWNTIME_LIMIT],
            params->downtime_limit);
        monitor_printf(mon, "\n");
    }

@@ -1260,6 +1273,7 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *qdict)
    hmp_handle_error(mon, &err);
}

/* Kept for backwards compatibility */
void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict)
{
    double value = qdict_get_double(qdict, "value");
@@ -1278,6 +1292,7 @@ void hmp_migrate_set_cache_size(Monitor *mon, const QDict *qdict)
    }
}

/* Kept for backwards compatibility */
void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict)
{
    int64_t value = qdict_get_int(qdict, "value");
@@ -1318,45 +1333,58 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
{
    const char *param = qdict_get_str(qdict, "parameter");
    const char *valuestr = qdict_get_str(qdict, "value");
    int64_t valuebw = 0;
    long valueint = 0;
    char *endp;
    Error *err = NULL;
    bool has_compress_level = false;
    bool has_compress_threads = false;
    bool has_decompress_threads = false;
    bool has_cpu_throttle_initial = false;
    bool has_cpu_throttle_increment = false;
    bool has_tls_creds = false;
    bool has_tls_hostname = false;
    bool use_int_value = false;
    int i;

    for (i = 0; i < MIGRATION_PARAMETER__MAX; i++) {
        if (strcmp(param, MigrationParameter_lookup[i]) == 0) {
            MigrationParameters p = { 0 };
            switch (i) {
            case MIGRATION_PARAMETER_COMPRESS_LEVEL:
                has_compress_level = true;
                p.has_compress_level = true;
                use_int_value = true;
                break;
            case MIGRATION_PARAMETER_COMPRESS_THREADS:
                has_compress_threads = true;
                p.has_compress_threads = true;
                use_int_value = true;
                break;
            case MIGRATION_PARAMETER_DECOMPRESS_THREADS:
                has_decompress_threads = true;
                p.has_decompress_threads = true;
                use_int_value = true;
                break;
            case MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL:
                has_cpu_throttle_initial = true;
                p.has_cpu_throttle_initial = true;
                use_int_value = true;
                break;
            case MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT:
                has_cpu_throttle_increment = true;
                p.has_cpu_throttle_increment = true;
                use_int_value = true;
                break;
            case MIGRATION_PARAMETER_TLS_CREDS:
                has_tls_creds = true;
                p.has_tls_creds = true;
                p.tls_creds = (char *) valuestr;
                break;
            case MIGRATION_PARAMETER_TLS_HOSTNAME:
                has_tls_hostname = true;
                p.has_tls_hostname = true;
                p.tls_hostname = (char *) valuestr;
                break;
            case MIGRATION_PARAMETER_MAX_BANDWIDTH:
                p.has_max_bandwidth = true;
                valuebw = qemu_strtosz(valuestr, &endp);
                if (valuebw < 0 || (size_t)valuebw != valuebw
                    || *endp != '\0') {
                    error_setg(&err, "Invalid size %s", valuestr);
                    goto cleanup;
                }
                p.max_bandwidth = valuebw;
                break;
            case MIGRATION_PARAMETER_DOWNTIME_LIMIT:
                p.has_downtime_limit = true;
                use_int_value = true;
                break;
            }

@@ -1366,16 +1394,17 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
                               valuestr);
                    goto cleanup;
                }
                /* Set all integers; only one has_FOO will be set, and
                 * the code ignores the remaining values */
                p.compress_level = valueint;
                p.compress_threads = valueint;
                p.decompress_threads = valueint;
                p.cpu_throttle_initial = valueint;
                p.cpu_throttle_increment = valueint;
                p.downtime_limit = valueint;
            }

            qmp_migrate_set_parameters(has_compress_level, valueint,
                                       has_compress_threads, valueint,
                                       has_decompress_threads, valueint,
                                       has_cpu_throttle_initial, valueint,
                                       has_cpu_throttle_increment, valueint,
                                       has_tls_creds, valuestr,
                                       has_tls_hostname, valuestr,
                                       &err);
            qmp_migrate_set_parameters(&p, &err);
            break;
        }
    }
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
void qemu_ram_set_idstr(RAMBlock *block, const char *name, DeviceState *dev);
void qemu_ram_unset_idstr(RAMBlock *block);
const char *qemu_ram_get_idstr(RAMBlock *rb);
size_t qemu_ram_pagesize(RAMBlock *block);

void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
                            int len, int is_write);
Loading