Skip to content

Commit

Permalink
Merge remote-tracking branch 'quintela/migration.next' into staging
Browse files Browse the repository at this point in the history
# By Michael R. Hines (9) and others
# Via Juan Quintela
* quintela/migration.next:
  rdma: introduce capability x-rdma-pin-all
  rdma: new QEMUFileOps hooks
  rdma: introduce qemu_ram_foreach_block()
  rdma: export qemu_fflush()
  rdma: introduce qemu_file_mode_is_not_valid()
  rdma: export throughput w/ MigrationStats QMP
  rdma: export yield_until_fd_readable()
  rdma: introduce qemu_update_position()
  rdma: add documentation
  migration: do not overwrite zero pages
  Revert "migration: do not sent zero pages in bulk stage"
  arch_init/ram_load: add error message for block length mismatch

Message-id: 1372329455-5995-1-git-send-email-quintela@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
  • Loading branch information
Anthony Liguori committed Jun 27, 2013
2 parents 3e50873 + 60d9222 commit c394ace
Show file tree
Hide file tree
Showing 12 changed files with 647 additions and 53 deletions.
42 changes: 27 additions & 15 deletions arch_init.c
Expand Up @@ -457,15 +457,10 @@ static int ram_save_block(QEMUFile *f, bool last_stage)
bytes_sent = -1;
if (is_zero_page(p)) {
acct_info.dup_pages++;
if (!ram_bulk_stage) {
bytes_sent = save_block_hdr(f, block, offset, cont,
RAM_SAVE_FLAG_COMPRESS);
qemu_put_byte(f, 0);
bytes_sent++;
} else {
acct_info.skipped_pages++;
bytes_sent = 0;
}
bytes_sent = save_block_hdr(f, block, offset, cont,
RAM_SAVE_FLAG_COMPRESS);
qemu_put_byte(f, 0);
bytes_sent++;
} else if (!ram_bulk_stage && migrate_use_xbzrle()) {
current_addr = block->offset + offset;
bytes_sent = save_xbzrle_page(f, p, current_addr, block,
Expand Down Expand Up @@ -498,6 +493,18 @@ static int ram_save_block(QEMUFile *f, bool last_stage)

static uint64_t bytes_transferred;

void acct_update_position(QEMUFile *f, size_t size, bool zero)
{
uint64_t pages = size / TARGET_PAGE_SIZE;
if (zero) {
acct_info.dup_pages += pages;
} else {
acct_info.norm_pages += pages;
bytes_transferred += size;
qemu_update_position(f, size);
}
}

static ram_addr_t ram_save_remaining(void)
{
return migration_dirty_pages;
Expand Down Expand Up @@ -808,6 +815,9 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
if (!strncmp(id, block->idstr, sizeof(id))) {
if (block->length != length) {
fprintf(stderr, "Length mismatch: %s: %ld "
"in != " RAM_ADDR_FMT "\n", id, length,
block->length);
ret = -EINVAL;
goto done;
}
Expand Down Expand Up @@ -837,14 +847,16 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
}

ch = qemu_get_byte(f);
memset(host, ch, TARGET_PAGE_SIZE);
if (ch != 0 || !is_zero_page(host)) {
memset(host, ch, TARGET_PAGE_SIZE);
#ifndef _WIN32
if (ch == 0 &&
(!kvm_enabled() || kvm_has_sync_mmu()) &&
getpagesize() <= TARGET_PAGE_SIZE) {
qemu_madvise(host, TARGET_PAGE_SIZE, QEMU_MADV_DONTNEED);
}
if (ch == 0 &&
(!kvm_enabled() || kvm_has_sync_mmu()) &&
getpagesize() <= TARGET_PAGE_SIZE) {
qemu_madvise(host, TARGET_PAGE_SIZE, QEMU_MADV_DONTNEED);
}
#endif
}
} else if (flags & RAM_SAVE_FLAG_PAGE) {
void *host;

Expand Down

0 comments on commit c394ace

Please sign in to comment.