From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbQQo-0000Ci-9Q for qemu-devel@nongnu.org; Fri, 27 Mar 2015 05:20:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbQQc-0004rX-5m for qemu-devel@nongnu.org; Fri, 27 Mar 2015 05:19:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43091) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbQQb-0004qX-TH for qemu-devel@nongnu.org; Fri, 27 Mar 2015 05:19:46 -0400 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 (8.14.4/8.14.4) with ESMTP id t2R9JjSB032425 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 27 Mar 2015 05:19:45 -0400 Message-ID: <551520AC.2070804@redhat.com> Date: Fri, 27 Mar 2015 10:19:40 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1427391520-29497-1-git-send-email-pbonzini@redhat.com> <1427391520-29497-15-git-send-email-pbonzini@redhat.com> <20150327061017.GB16079@ad.nay.redhat.com> In-Reply-To: <20150327061017.GB16079@ad.nay.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 14/22] exec: only check relevant bitmaps for cleanliness List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org On 27/03/2015 07:10, Fam Zheng wrote: >> static inline bool cpu_physical_memory_range_includes_clean(ram_addr_t start, >> - ram_addr_t length) >> + ram_addr_t length, >> + uint8_t mask) >> { >> - bool vga = cpu_physical_memory_get_clean(start, length, DIRTY_MEMORY_VGA); >> - bool code = cpu_physical_memory_get_clean(start, length, DIRTY_MEMORY_CODE); >> - bool migration = >> - cpu_physical_memory_get_clean(start, length, DIRTY_MEMORY_MIGRATION); >> - return vga || code || migration; >> + bool clean = false; >> + if (mask & (1 << DIRTY_MEMORY_VGA)) { >> + clean = cpu_physical_memory_get_clean(start, length, DIRTY_MEMORY_VGA); >> + } >> + if (!clean && (mask & (1 << DIRTY_MEMORY_CODE))) { >> + clean = cpu_physical_memory_get_clean(start, length, DIRTY_MEMORY_CODE); >> + } >> + if (!clean && (mask & (1 << DIRTY_MEMORY_MIGRATION))) { >> + clean = cpu_physical_memory_get_clean(start, length, DIRTY_MEMORY_MIGRATION); >> + } >> + return clean; >> } > > Out of curiosity, is it valid that a mask bit is cleared but the corresponding > dirty bit is set? Yes, for example if migration is cancelled you'll have some bits set in the DIRTY_MEMORY_MIGRATION bitmap, but DIRTY_MEMORY_MIGRATION itself will not be enabled. Paolo >> >> static inline void cpu_physical_memory_set_dirty_flag(ram_addr_t addr, >> -- >> 2.3.3 >> >> >>