From: Juan Quintela <quintela@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Anthony Liguori <anthony@codemonkey.ws>,
Umesh Deshpande <udeshpan@redhat.com>,
qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [RFC] New thread for the VM migration
Date: Thu, 14 Jul 2011 17:30:28 +0200 [thread overview]
Message-ID: <m3aacg7ucr.fsf@neno.neno> (raw)
In-Reply-To: <4E1EE1F2.5020801@redhat.com> (Avi Kivity's message of "Thu, 14 Jul 2011 15:32:50 +0300")
Avi Kivity <avi@redhat.com> wrote:
> On 07/14/2011 03:30 PM, Anthony Liguori wrote:
>>> Does this mean that the following code is sometimes executed without
>>> qemu_mutex? I don't think any of it is thread safe.
>>
>>
>> That was my reaction too.
>>
>> I think the most rational thing to do is have a separate thread and
>> a pair of producer/consumer queues.
>>
>> The I/O thread can push virtual addresses and sizes to the queue for
>> the migration thread to compress/write() to the fd. The migration
>> thread can then push sent regions onto a separate queue for the I/O
>> thread to mark as dirty.
>
> Even virtual addresses are not safe enough, because of hotunplug.
> Without some kind of locking, you have to copy the data.
Disabling hotplug should be enough? Notice that hotplug/unplug during
migration don't make a lot of sense anyways.
Not all the bitmap syncying has proper locking now (copyng towards one
place), but rest of cade looks really thread safe to me (migration code
is only called from this thread, so it should be safe).
My understanding on how this work:
vcpu thread modifies momery
iothread (some times) modifies memory
migration thread: reads memory, and gets the lock before syncing its
bitmap with kvm one and qemu one (clearing it on the time).
Assume we disable hotplug/unplug (what we have to do anyways). What is
the locking problem that we have?
We do stage 3 with the iothread locked, i.e. at that point everything
else is stopped. Before stage 3, can kvm or qemu modify a page and
_not_ modify the bitmap? My understanding is not.
Only real variable that we are sharing is ram_list, or I am losing
something obvious?
Later, Juan.
next prev parent reply other threads:[~2011-07-14 15:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <539565793.1312156.1310595395982.JavaMail.root@zmail01.collab.prod.int.phx2.redhat.com>
2011-07-13 23:34 ` [RFC] New thread for the VM migration Umesh Deshpande
2011-07-14 7:14 ` Umesh Deshpande
2011-07-14 8:36 ` [Qemu-devel] " Avi Kivity
2011-07-14 9:09 ` Stefan Hajnoczi
2011-07-14 12:30 ` Anthony Liguori
2011-07-14 12:32 ` Avi Kivity
2011-07-14 15:30 ` Juan Quintela [this message]
2011-07-14 15:44 ` Avi Kivity
2011-07-14 15:52 ` Juan Quintela
2011-07-14 16:07 ` Avi Kivity
2011-07-15 7:59 ` Paolo Bonzini
2011-07-15 7:59 ` Paolo Bonzini
2011-07-15 21:09 ` [Qemu-devel] " Anthony Liguori
2011-07-17 8:39 ` Avi Kivity
2011-07-18 7:08 ` [Qemu-devel] " Markus Armbruster
2011-07-14 16:49 ` Anthony Liguori
2011-07-14 16:59 ` Avi Kivity
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=m3aacg7ucr.fsf@neno.neno \
--to=quintela@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=udeshpan@redhat.com \
/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