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 11:36:02 +0300 Message-ID: <4E1EAA72.1060103@redhat.com> References: <1447945249.1317755.1310627692984.JavaMail.root@zmail01.collab.prod.int.phx2.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org To: Umesh Deshpande Return-path: Received: from mx1.redhat.com ([209.132.183.28]:8238 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752466Ab1GNIgI (ORCPT ); Thu, 14 Jul 2011 04:36:08 -0400 In-Reply-To: <1447945249.1317755.1310627692984.JavaMail.root@zmail01.collab.prod.int.phx2.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 07/14/2011 10:14 AM, Umesh Deshpande wrote: > Following patch is implemented to deal with the VCPU and iothread starvation during the migration of a guest. Currently iothread is responsible for performing the migration. It holds the qemu_mutex during the migration and doesn't allow VCPU to enter the qemu mode and delays its return to the guest. The guest migration, executed as an iohandler also delays the execution of other iohandlers. In the following patch, the migration has been moved to a separate thread to reduce the qemu_mutex contention and iohandler starvation. > > > @@ -260,10 +260,15 @@ int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque) > return 0; > } > > + if (stage != 3) > + qemu_mutex_lock_iothread(); Please read CODING_STYLE, especially the bit about braces. Does this mean that the following code is sometimes executed without qemu_mutex? I don't think any of it is thread safe. Even just reading memory is not thread safe. You either have to copy it into a buffer under lock, or convert the memory API to RCU. -- error compiling committee.c: too many arguments to function