qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/4] ram: reuse ram_save_iterate() for the complete stage
Date: Fri, 18 Jan 2013 12:53:52 +0100	[thread overview]
Message-ID: <1358510033-17268-4-git-send-email-quintela@redhat.com> (raw)
In-Reply-To: <1358510033-17268-1-git-send-email-quintela@redhat.com>

This means that we only have one memory loop for the iterate and
complete phase.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 arch_init.c | 16 ----------------
 migration.c | 12 ++++++++++++
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index 9f7d44d..9eef10a 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -651,23 +651,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque, uint64_t free_space)
 static int ram_save_complete(QEMUFile *f, void *opaque)
 {
     qemu_mutex_lock_ramlist();
-    migration_bitmap_sync();
-
-    /* try transferring iterative blocks of memory */
-
-    /* flush all remaining blocks regardless of rate limiting */
-    while (true) {
-        int bytes_sent;
-
-        bytes_sent = ram_save_block(f);
-        /* no more blocks to sent */
-        if (bytes_sent == 0) {
-            break;
-        }
-        bytes_transferred += bytes_sent;
-    }
     migration_end();
-
     qemu_mutex_unlock_ramlist();
     qemu_put_be64(f, RAM_SAVE_FLAG_EOS);

diff --git a/migration.c b/migration.c
index e74ce49..de665f7 100644
--- a/migration.c
+++ b/migration.c
@@ -717,6 +717,18 @@ static void *buffered_file_thread(void *opaque)
                 } else {
                     vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
                 }
+
+                /* 8 is the size of an end of section mark, so empty section */
+                while ((ret = qemu_savevm_state_iterate(s->file, free_space))
+                    > 8) {
+                    ret = buffered_flush(s);
+                    if (ret < 0) {
+                        qemu_mutex_unlock_iothread();
+                        break;
+                    }
+                    free_space = s->buffer_capacity - s->buffer_size;
+                }
+
                 ret = qemu_savevm_state_complete(s->file);
                 if (ret < 0) {
                     qemu_mutex_unlock_iothread();
-- 
1.8.1

  parent reply	other threads:[~2013-01-18 11:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-18 11:53 [Qemu-devel] [RFC 0/4] migration.experimental queue Juan Quintela
2013-01-18 11:53 ` [Qemu-devel] [PATCH 1/4] ram: add free_space parameter to save_live functions Juan Quintela
2013-01-21  9:59   ` Orit Wasserman
2013-01-18 11:53 ` [Qemu-devel] [PATCH 2/4] ram: remove xbrle last_stage optimization Juan Quintela
2013-01-21 10:11   ` Orit Wasserman
2013-01-18 11:53 ` Juan Quintela [this message]
2013-01-21 10:17   ` [Qemu-devel] [PATCH 3/4] ram: reuse ram_save_iterate() for the complete stage Orit Wasserman
2013-01-21 10:31   ` Paolo Bonzini
2013-01-18 11:53 ` [Qemu-devel] [PATCH 4/4] migration: print times for end phase Juan Quintela
2013-01-21 10:19   ` Orit Wasserman

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=1358510033-17268-4-git-send-email-quintela@redhat.com \
    --to=quintela@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).