From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [RFC PATCH v4 2/5] ramlist mutex Date: Tue, 23 Aug 2011 09:16:30 -0300 Message-ID: <20110823121630.GA4261@amt.cnet> References: <8f99d56f3a48b6255cf70425bc435d8f231f5352.1313552764.git.udeshpan@redhat.com> <20110823091533.GA5207@amt.cnet> <20110823091726.GA5797@amt.cnet> <4E5391FC.1060703@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Umesh Deshpande , qemu-devel@nongnu.org, kvm@vger.kernel.org, quintela@redhat.com To: Paolo Bonzini Return-path: Content-Disposition: inline In-Reply-To: <4E5391FC.1060703@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org On Tue, Aug 23, 2011 at 01:41:48PM +0200, Paolo Bonzini wrote: > 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 Yep.