From patchwork Tue Feb 14 09:27:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 141094 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BDD79B6FA1 for ; Tue, 14 Feb 2012 21:38:13 +1100 (EST) Received: from localhost ([::1]:32787 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxEh4-0004sC-7f for incoming@patchwork.ozlabs.org; Tue, 14 Feb 2012 04:29:02 -0500 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 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 8A034250BB6; Tue, 14 Feb 2012 11:27:58 +0200 (IST) From: Avi Kivity To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 12/20] memory: move tlb flush to MemoryListener commit callback X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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,