From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvpMi-00083w-KW for qemu-devel@nongnu.org; Tue, 23 Aug 2011 07:41:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvpMh-0001av-I5 for qemu-devel@nongnu.org; Tue, 23 Aug 2011 07:41:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvpMh-0001ar-9d for qemu-devel@nongnu.org; Tue, 23 Aug 2011 07:41:55 -0400 Message-ID: <4E5391FC.1060703@redhat.com> Date: Tue, 23 Aug 2011 13:41:48 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <8f99d56f3a48b6255cf70425bc435d8f231f5352.1313552764.git.udeshpan@redhat.com> <20110823091533.GA5207@amt.cnet> <20110823091726.GA5797@amt.cnet> In-Reply-To: <20110823091726.GA5797@amt.cnet> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH v4 2/5] ramlist mutex List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcelo Tosatti Cc: Umesh Deshpande , qemu-devel@nongnu.org, kvm@vger.kernel.org, quintela@redhat.com On 08/23/2011 11:17 AM, Marcelo Tosatti wrote: >>> > > typedef struct RAMList { >>> > > + QemuMutex mutex; >>> > > uint8_t *phys_dirty; >>> > > QLIST_HEAD(ram, RAMBlock) blocks; >>> > > QLIST_HEAD(, RAMBlock) blocks_mru; >> > >> > A comment on what the mutex protects would be good. Indeed, especially because Umesh wanted to use the ramlist+iothread combo as a rw-lock: iothread = read-lock for the I/O thread, ramlist = read-lock for the migration thread, together = exclusive (write) lock. But I think I talked him out of this. :) It's not a bad idea in general, it just sounds like overkill in this case. > And on the lock ordering. I think when only two locks are involved, we can always assume iothread is outer and the other is inner. Do you agree? Paolo