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 >> >> >>