From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YC6ZB-0003KV-Pj for qemu-devel@nongnu.org; Fri, 16 Jan 2015 08:03:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YC6Z8-0005ar-GV for qemu-devel@nongnu.org; Fri, 16 Jan 2015 08:03:57 -0500 Received: from mx2.parallels.com ([199.115.105.18]:37319) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YC6Z8-0005ai-Bq for qemu-devel@nongnu.org; Fri, 16 Jan 2015 08:03:54 -0500 Message-ID: <54B90C2C.8020606@parallels.com> Date: Fri, 16 Jan 2015 16:03:40 +0300 From: Vladimir Sementsov-Ogievskiy MIME-Version: 1.0 References: <1418307457-25996-1-git-send-email-vsementsov@parallels.com> <1418307457-25996-8-git-send-email-vsementsov@parallels.com> <54AF049F.6020207@redhat.com> In-Reply-To: <54AF049F.6020207@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 7/9] block-migration: remove not needed iothread lock List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: kwolf@redhat.com, den@openvz.org, jsnow@redhat.com, stefanha@redhat.com Best regards, Vladimir On 09.01.2015 01:28, Paolo Bonzini wrote: > > On 11/12/2014 15:17, Vladimir Sementsov-Ogievskiy wrote: >> - qemu_mutex_lock_iothread(); >> + bdrv_reset_dirty_bitmap(bs, bmds->dirty_bitmap, cur_sector, nr_sectors); >> + >> blk->aiocb = bdrv_aio_readv(bs, cur_sector, &blk->qiov, >> nr_sectors, blk_mig_read_cb, blk); >> >> - bdrv_reset_dirty_bitmap(bs, bmds->dirty_bitmap, cur_sector, nr_sectors); >> - qemu_mutex_unlock_iothread(); >> - > bdrv_aio_readv is not thread safe, so it needs the iothread lock. > > bdrv_reset_dirty_bitmap is also not thread safe, because > bmds->dirty_bitmap is accessed concurrently by bdrv_reset_dirty > (discard) and bdrv_set_dirty (write). So it needs the iothread lock too. > > Moving bdrv_reset_dirty_bitmap before the read is a good idea. > > Paolo Ok.