From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:39665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxEgG-0002z5-I3 for qemu-devel@nongnu.org; Tue, 14 Feb 2012 04:28:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RxEgB-0003Vs-6t for qemu-devel@nongnu.org; Tue, 14 Feb 2012 04:28:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49954) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxEgA-0003V1-OP for qemu-devel@nongnu.org; Tue, 14 Feb 2012 04:28:07 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1E9S6kL004827 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 14 Feb 2012 04:28:06 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q1E9S2he012767 for ; Tue, 14 Feb 2012 04:28:05 -0500 From: Avi Kivity Date: Tue, 14 Feb 2012 11:27:42 +0200 Message-Id: <1329211670-11548-13-git-send-email-avi@redhat.com> In-Reply-To: <1329211670-11548-1-git-send-email-avi@redhat.com> References: <1329211670-11548-1-git-send-email-avi@redhat.com> Subject: [Qemu-devel] [PATCH 12/20] memory: move tlb flush to MemoryListener commit callback List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This way, if we have several changes in a single transaction, we flush just once. Signed-off-by: Avi Kivity --- exec.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/exec.c b/exec.c index 6232a39..2171eba 100644 --- a/exec.c +++ b/exec.c @@ -2625,7 +2625,6 @@ void cpu_register_physical_memory_log(MemoryRegionSection *section, target_phys_addr_t start_addr = section->offset_within_address_space; ram_addr_t size = section->size; target_phys_addr_t addr, end_addr; - CPUState *env; ram_addr_t orig_size = size; subpage_t *subpage; uint16_t section_index = phys_section_add(section); @@ -2659,13 +2658,6 @@ void cpu_register_physical_memory_log(MemoryRegionSection *section, } addr += TARGET_PAGE_SIZE; } while (addr != end_addr); - - /* since each CPU stores ram addresses in its TLB cache, we must - reset the modified entries */ - /* XXX: slow ! */ - for(env = first_cpu; env != NULL; env = env->next_cpu) { - tlb_flush(env, 1); - } } void qemu_register_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size) @@ -3563,6 +3555,14 @@ static void core_begin(MemoryListener *listener) static void core_commit(MemoryListener *listener) { + CPUState *env; + + /* since each CPU stores ram addresses in its TLB cache, we must + reset the modified entries */ + /* XXX: slow ! */ + for(env = first_cpu; env != NULL; env = env->next_cpu) { + tlb_flush(env, 1); + } } static void core_region_add(MemoryListener *listener, -- 1.7.9