The function has just set two dirty bits and invalidated code, thus cpu_physical_memory_is_clean cannot return true here.
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- exec.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/exec.c b/exec.c index ffa57dd..56fd0f5 100644 --- a/exec.c +++ b/exec.c @@ -1810,6 +1810,7 @@ found: static void notdirty_mem_write(void *opaque, hwaddr ram_addr, uint64_t val, unsigned size) { + CPUArchState *env = current_cpu->env_ptr; if (!cpu_physical_memory_get_dirty_flag(ram_addr, DIRTY_MEMORY_CODE)) { tb_invalidate_phys_page_fast(ram_addr, size); } @@ -1827,12 +1828,7 @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr, abort(); } cpu_physical_memory_set_dirty_range_nocode(ram_addr, size); - /* we remove the notdirty callback only if the code has been - flushed */ - if (!cpu_physical_memory_is_clean(ram_addr)) { - CPUArchState *env = current_cpu->env_ptr; - tlb_set_dirty(env, current_cpu->mem_io_vaddr); - } + tlb_set_dirty(env, current_cpu->mem_io_vaddr); } static bool notdirty_mem_accepts(void *opaque, hwaddr addr, -- 2.3.3