From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYCWB-0004bw-Eg for qemu-devel@nongnu.org; Tue, 23 Feb 2016 07:56:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYCW6-0002xj-EQ for qemu-devel@nongnu.org; Tue, 23 Feb 2016 07:56:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYCW6-0002xa-8c for qemu-devel@nongnu.org; Tue, 23 Feb 2016 07:56:38 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id CEE84C0BA405 for ; Tue, 23 Feb 2016 12:56:37 +0000 (UTC) Date: Tue, 23 Feb 2016 20:56:35 +0800 From: Fam Zheng Message-ID: <20160223125635.GC26812@ad.usersys.redhat.com> References: <1455894643-16280-1-git-send-email-pbonzini@redhat.com> <20160223053926.GA23182@ad.usersys.redhat.com> <56CC299F.3040509@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56CC299F.3040509@redhat.com> Subject: Re: [Qemu-devel] [PATCH] fixup! block-migration: acquire AioContext as necessary List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, mst@redhat.com On Tue, 02/23 10:42, Paolo Bonzini wrote: > > > On 23/02/2016 06:39, Fam Zheng wrote: > > BTW, could you also explain the blk_mig_lock() question (*) I had? > > > > *: https://lists.gnu.org/archive/html/qemu-devel/2016-02/msg03317.html > > Sorry, missed that: > > > > >> @@ -597,21 +627,28 @@ static void block_migration_cleanup(void *opaque) > >> { > >> BlkMigDevState *bmds; > >> BlkMigBlock *blk; > >> + AioContext *ctx; > >> > >> bdrv_drain_all(); > >> > >> unset_dirty_tracking(); > >> > >> - blk_mig_lock(); > > > > Why is it okay to skip the blk_mig_lock() for block_mig_state.bmds_list? > > The bmds_list is not protected by blk_mig_lock: > > /* Written during setup phase. Can be read without a lock. */ > int blk_enable; > int shared_base; > QSIMPLEQ_HEAD(bmds_list, BlkMigDevState) bmds_list; > int64_t total_sector_sum; > bool zero_blocks; > > block_migration_cleanup is called from qemu_savevm_state_cleanup, when > there can be no concurrency between the migration thread and the I/O > thread. In fact the call of qemu_savevm_state_cleanup might as well be > moved out of the migration thread. Thanks! Fam