From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ztad6-0004AU-R8 for qemu-devel@nongnu.org; Tue, 03 Nov 2015 07:24:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ztad3-0001Pg-OK for qemu-devel@nongnu.org; Tue, 03 Nov 2015 07:24:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ztad3-0001Pb-JY for qemu-devel@nongnu.org; Tue, 03 Nov 2015 07:23:57 -0500 Date: Tue, 3 Nov 2015 12:23:53 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20151103122353.GB17670@work-vm> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] safety of migration_bitmap_extend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: lizhijian@cn.fujitsu.com, den@openvz.org, quintela@redhat.com Cc: qemu-devel@nongnu.org Hi, I'm trying to understand why migration_bitmap_extend is correct/safe; If I understand correctly, you're arguing that: 1) the migration_bitmap_mutex around the extend, stops any sync's happening and so no new bits will be set during the extend. 2) If migration sends a page and clears a bitmap entry, it doesn't matter if we lose the 'clear' because we're copying it as we extend it, because losing the clear just means the page gets resent, and so the data is OK. However, doesn't (2) mean that migration_dirty_pages might be wrong? If a page was sent, the bit cleared, and migration_dirty_pages decremented, then if we copy over that bitmap and 'set' that bit again then migration_dirty_pages is too small; that means that either migration would finish too early, or more likely, migration_dirty_pages would wrap-around -ve and never finish. Is there a reason it's really safe? Dave -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK