From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ec5nH-0007cF-Aw for qemu-devel@nongnu.org; Thu, 18 Jan 2018 03:43:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ec5nG-0002RO-AW for qemu-devel@nongnu.org; Thu, 18 Jan 2018 03:43:31 -0500 References: <20171220154945.88410-1-vsementsov@virtuozzo.com> <20171220154945.88410-4-vsementsov@virtuozzo.com> <20171228052418.GC9192@lemon> <20171229013140.GA13004@lemon> From: Paolo Bonzini Message-ID: <9b13ad99-981c-f623-0a71-6d1aad73c159@redhat.com> Date: Thu, 18 Jan 2018 09:43:00 +0100 MIME-Version: 1.0 In-Reply-To: <20171229013140.GA13004@lemon> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v9 03/13] block/dirty-bitmap: add _locked version of bdrv_reclaim_dirty_bitmap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , Vladimir Sementsov-Ogievskiy Cc: kwolf@redhat.com, peter.maydell@linaro.org, lirans@il.ibm.com, qemu-block@nongnu.org, quintela@redhat.com, jsnow@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, den@openvz.org, amit.shah@redhat.com, mreitz@redhat.com, dgilbert@redhat.com On 29/12/2017 02:31, Fam Zheng wrote: >> we have the following comment: >> >> =C2=A0=C2=A0=C2=A0 /* Writing to the list requires the BQL _and_ the d= irty_bitmap_mutex. >> =C2=A0=C2=A0=C2=A0=C2=A0 * Reading from the list can be done with eith= er the BQL or the >> =C2=A0=C2=A0=C2=A0=C2=A0 * dirty_bitmap_mutex.=C2=A0 Modifying a bitma= p only requires >> =C2=A0=C2=A0=C2=A0=C2=A0 * dirty_bitmap_mutex. */ >> =C2=A0=C2=A0=C2=A0 QemuMutex dirty_bitmap_mutex; >> >> (I don't understand well the logic, why is it so. Paolo introduced the= lock, >> but didn't update some functions..) >> >> so, actually, here we need both BQL and mutex. > > Yes, because of that comment my interpretion has been both "BQL and the= mutex" > whereever we say "within bdrv_dirty_bitmap_lock..unlock", as to some ot= her > places in this file. A bit late, but---no, "within bdrv_dirty_bitmap_lock..unlock" means it's the "modifying the bitmap" case. Most functions that looks at the list are "called with BQL taken". Functions that write to the list are "called with BQL taken" and call bdrv_dirty_bitmaps_lock/bdrv_dirty_bitmaps_unlock themselves. Paolo