From 6bbfcf65e836c1eb94201b79e643b0c24acdff4c Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 13 Feb 2018 10:46:27 -0500 Subject: [PATCH] memory: do not touch code dirty bitmap unless TCG is enabled cpu_physical_memory_set_dirty_lebitmap unconditionally syncs the DIRTY_MEMORY_CODE bitmap. This however is unused unless TCG is enabled. Backports commit 9460dee4b2258e3990906fb34099481c8334c267 from qemu --- qemu/include/exec/ram_addr.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qemu/include/exec/ram_addr.h b/qemu/include/exec/ram_addr.h index 551bf702..c8d12195 100644 --- a/qemu/include/exec/ram_addr.h +++ b/qemu/include/exec/ram_addr.h @@ -125,10 +125,13 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(struct uc_struct *uc, for (k = 0; k < nr; k++) { if (bitmap[k]) { unsigned long temp = leul_to_cpu(bitmap[k]); - uc->ram_list.dirty_memory[DIRTY_MEMORY_CODE][page + k] |= temp; + if (tcg_enabled(uc)) { + uc->ram_list.dirty_memory[DIRTY_MEMORY_CODE][page + k] |= temp; + } } } } else { + uint8_t clients = tcg_enabled(uc) ? DIRTY_CLIENTS_ALL : DIRTY_CLIENTS_NOCODE; /* * bitmap-traveling is faster than memory-traveling (for addr...) * especially when most of the memory is not dirty. @@ -143,8 +146,7 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(struct uc_struct *uc, addr = page_number * TARGET_PAGE_SIZE; ram_addr = start + addr; cpu_physical_memory_set_dirty_range(uc, ram_addr, - TARGET_PAGE_SIZE * hpratio, - DIRTY_CLIENTS_ALL); + TARGET_PAGE_SIZE * hpratio, clients); } while (c != 0); } }