From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QhPNS-0001yt-Tw for qemu-devel@nongnu.org; Thu, 14 Jul 2011 13:07:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QhP6t-00055X-4z for qemu-devel@nongnu.org; Thu, 14 Jul 2011 12:50:00 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:61591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QhP6s-00055L-Ny for qemu-devel@nongnu.org; Thu, 14 Jul 2011 12:49:58 -0400 Received: by gyf2 with SMTP id 2so205884gyf.4 for ; Thu, 14 Jul 2011 09:49:57 -0700 (PDT) Message-ID: <4E1F1E33.6010305@codemonkey.ws> Date: Thu, 14 Jul 2011 11:49:55 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1447945249.1317755.1310627692984.JavaMail.root@zmail01.collab.prod.int.phx2.redhat.com> <4E1EAA72.1060103@redhat.com> <4E1EE183.5050100@codemonkey.ws> <4E1EE1F2.5020801@redhat.com> In-Reply-To: <4E1EE1F2.5020801@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC] New thread for the VM migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: Umesh Deshpande , qemu-devel@nongnu.org, kvm@vger.kernel.org On 07/14/2011 07:32 AM, Avi Kivity 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. We don't know yet how we're going to implement hot unplug so let's not worry about this for now. I think a reference count based approach is really the only sane thing to do and if we did that, it wouldn't be a problem since the reference would be owned by the I/O thread and would live until the migration thread is done with the VA. Regards, Anthony Liguori >