From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [Qemu-devel] [RFC] New thread for the VM migration Date: Thu, 14 Jul 2011 15:32:50 +0300 Message-ID: <4E1EE1F2.5020801@redhat.com> References: <1447945249.1317755.1310627692984.JavaMail.root@zmail01.collab.prod.int.phx2.redhat.com> <4E1EAA72.1060103@redhat.com> <4E1EE183.5050100@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Umesh Deshpande , qemu-devel@nongnu.org, kvm@vger.kernel.org To: Anthony Liguori Return-path: Received: from mx1.redhat.com ([209.132.183.28]:27966 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754428Ab1GNMc5 (ORCPT ); Thu, 14 Jul 2011 08:32:57 -0400 In-Reply-To: <4E1EE183.5050100@codemonkey.ws> Sender: kvm-owner@vger.kernel.org List-ID: 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. -- error compiling committee.c: too many arguments to function