From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Alex Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] migration: broken ram_save_pending
Date: Fri, 07 Feb 2014 00:49:11 +0100 [thread overview]
Message-ID: <52F41F77.7000608@redhat.com> (raw)
In-Reply-To: <52F2FD2B.9010504@ozlabs.ru>
Il 06/02/2014 04:10, Alexey Kardashevskiy ha scritto:
>> > Ok, I thought Alexey was saying we are not redirtying that handful of pages.
>
> Every iteration we read the dirty map from KVM and send all dirty pages
> across the stream.
But we never finish because qemu_savevm_state_pending is only called _after_
the g_usleep? And thus there's time for the guest to redirty those pages.
Does something like this fix it (of course for a proper pages the goto
should be eliminated)?
diff --git a/migration.c b/migration.c
index 7235c23..804c3bd 100644
--- a/migration.c
+++ b/migration.c
@@ -589,6 +589,7 @@ static void *migration_thread(void *opaque)
} else {
int ret;
+final_phase:
DPRINTF("done iterating\n");
qemu_mutex_lock_iothread();
start_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
@@ -640,10 +641,16 @@ static void *migration_thread(void *opaque)
qemu_file_reset_rate_limit(s->file);
initial_time = current_time;
initial_bytes = qemu_ftell(s->file);
- }
- if (qemu_file_rate_limit(s->file)) {
- /* usleep expects microseconds */
- g_usleep((initial_time + BUFFER_DELAY - current_time)*1000);
+ } else if (qemu_file_rate_limit(s->file)) {
+ pending_size = qemu_savevm_state_pending(s->file, max_size);
+ DPRINTF("pending size %" PRIu64 " max %" PRIu64 "\n",
+ pending_size, max_size);
+ if (pending_size >= max_size) {
+ /* usleep expects microseconds */
+ g_usleep((initial_time + BUFFER_DELAY - current_time)*1000);
+ } else {
+ goto final_phase;
+ }
}
}
next prev parent reply other threads:[~2014-02-06 23:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-04 7:15 [Qemu-devel] migration: broken ram_save_pending Alexey Kardashevskiy
2014-02-04 10:46 ` Paolo Bonzini
2014-02-04 11:59 ` Alexey Kardashevskiy
2014-02-04 12:07 ` Paolo Bonzini
2014-02-04 12:16 ` Alexey Kardashevskiy
2014-02-04 14:00 ` Paolo Bonzini
2014-02-04 22:17 ` Alexey Kardashevskiy
2014-02-05 7:18 ` Paolo Bonzini
2014-02-05 9:09 ` Dr. David Alan Gilbert
2014-02-05 16:35 ` Paolo Bonzini
2014-02-05 16:42 ` Dr. David Alan Gilbert
2014-02-05 16:45 ` Paolo Bonzini
2014-02-06 3:10 ` Alexey Kardashevskiy
2014-02-06 11:24 ` Dr. David Alan Gilbert
2014-02-07 5:39 ` Alexey Kardashevskiy
2014-02-07 8:55 ` Dr. David Alan Gilbert
2014-02-06 23:49 ` Paolo Bonzini [this message]
2014-02-07 5:42 ` Alexey Kardashevskiy
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=52F41F77.7000608@redhat.com \
--to=pbonzini@redhat.com \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=dgilbert@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).