Commit bef81b3e authored by Peter Maydell's avatar Peter Maydell
Browse files

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



migration/next for 20170922

# gpg: Signature made Fri 22 Sep 2017 13:15:06 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/20170922-1:
  migration: split ufd_version_check onto receive/request features part
  migration: fix hardcoded function name in error report
  migration: pass MigrationIncomingState* into migration check functions
  migration: split common postcopy out of ram postcopy
  migration: fix ram_save_pending
  migration: add has_postcopy savevm handler
  bitmap: provide to_le/from_le helpers
  bitmap: introduce bitmap_count_one()
  bitmap: remove BITOP_WORD()
  migration: Split migration_fd_process_incoming
  migration: Create multifd migration threads
  migration: Create x-multifd-page-count parameter
  migration: Create x-multifd-channels parameter
  migration: Add multifd capability
  migration: Create migration_has_all_channels
  migration: Add comments to channel functions
  migration: Teach it about G_SOURCE_REMOVE
  migration: Create migration_ioc_process_incoming()

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 159a9df0 54ae0886
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -336,6 +336,12 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
        monitor_printf(mon, "%s: %s\n",
            MigrationParameter_str(MIGRATION_PARAMETER_BLOCK_INCREMENTAL),
            params->block_incremental ? "on" : "off");
        monitor_printf(mon, "%s: %" PRId64 "\n",
            MigrationParameter_str(MIGRATION_PARAMETER_X_MULTIFD_CHANNELS),
            params->x_multifd_channels);
        monitor_printf(mon, "%s: %" PRId64 "\n",
            MigrationParameter_str(MIGRATION_PARAMETER_X_MULTIFD_PAGE_COUNT),
            params->x_multifd_page_count);
    }

    qapi_free_MigrationParameters(params);
@@ -1621,6 +1627,14 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
        p->has_block_incremental = true;
        visit_type_bool(v, param, &p->block_incremental, &err);
        break;
    case MIGRATION_PARAMETER_X_MULTIFD_CHANNELS:
        p->has_x_multifd_channels = true;
        visit_type_int(v, param, &p->x_multifd_channels, &err);
        break;
    case MIGRATION_PARAMETER_X_MULTIFD_PAGE_COUNT:
        p->has_x_multifd_page_count = true;
        visit_type_int(v, param, &p->x_multifd_page_count, &err);
        break;
    default:
        assert(0);
    }
+2 −0
Original line number Diff line number Diff line
@@ -223,6 +223,8 @@ static inline gboolean g_hash_table_contains(GHashTable *hash_table,
{
    return g_hash_table_lookup_extended(hash_table, key, NULL, NULL);
}
#define G_SOURCE_CONTINUE TRUE
#define G_SOURCE_REMOVE FALSE
#endif

#ifndef g_assert_true
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ typedef struct SaveVMHandlers {

    /* This runs both outside and inside the iothread lock.  */
    bool (*is_active)(void *opaque);
    bool (*has_postcopy)(void *opaque);

    /* This runs outside the iothread lock in the migration case, and
     * within the lock in the savevm case.  The callback had better only
+17 −0
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@
 * bitmap_clear(dst, pos, nbits)		Clear specified bit area
 * bitmap_test_and_clear_atomic(dst, pos, nbits)    Test and clear area
 * bitmap_find_next_zero_area(buf, len, pos, n, mask)	Find bit free area
 * bitmap_to_le(dst, src, nbits)      Convert bitmap to little endian
 * bitmap_from_le(dst, src, nbits)    Convert bitmap from little endian
 */

/*
@@ -82,6 +84,7 @@ int slow_bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
                       const unsigned long *bitmap2, long bits);
int slow_bitmap_intersects(const unsigned long *bitmap1,
                           const unsigned long *bitmap2, long bits);
long slow_bitmap_count_one(const unsigned long *bitmap, long nbits);

static inline unsigned long *bitmap_try_new(long nbits)
{
@@ -216,6 +219,15 @@ static inline int bitmap_intersects(const unsigned long *src1,
    }
}

static inline long bitmap_count_one(const unsigned long *bitmap, long nbits)
{
    if (small_nbits(nbits)) {
        return ctpopl(*bitmap & BITMAP_LAST_WORD_MASK(nbits));
    } else {
        return slow_bitmap_count_one(bitmap, nbits);
    }
}

void bitmap_set(unsigned long *map, long i, long len);
void bitmap_set_atomic(unsigned long *map, long i, long len);
void bitmap_clear(unsigned long *map, long start, long nr);
@@ -237,4 +249,9 @@ static inline unsigned long *bitmap_zero_extend(unsigned long *old,
    return new;
}

void bitmap_to_le(unsigned long *dst, const unsigned long *src,
                  long nbits);
void bitmap_from_le(unsigned long *dst, const unsigned long *src,
                    long nbits);

#endif /* BITMAP_H */
+16 −2
Original line number Diff line number Diff line
@@ -19,6 +19,14 @@
#include "qapi/error.h"
#include "io/channel-tls.h"

/**
 * @migration_channel_process_incoming - Create new incoming migration channel
 *
 * Notice that TLS is special.  For it we listen in a listener socket,
 * and then create a new client socket from the TLS library.
 *
 * @ioc: Channel to which we are connecting
 */
void migration_channel_process_incoming(QIOChannel *ioc)
{
    MigrationState *s = migrate_get_current();
@@ -36,12 +44,18 @@ void migration_channel_process_incoming(QIOChannel *ioc)
            error_report_err(local_err);
        }
    } else {
        QEMUFile *f = qemu_fopen_channel_input(ioc);
        migration_fd_process_incoming(f);
        migration_ioc_process_incoming(ioc);
    }
}


/**
 * @migration_channel_connect - Create new outgoing migration channel
 *
 * @s: Current migration state
 * @ioc: Channel to which we are connecting
 * @hostname: Where we want to connect
 */
void migration_channel_connect(MigrationState *s,
                               QIOChannel *ioc,
                               const char *hostname)
Loading