From patchwork Tue Oct 9 16:32:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 190384 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C5F142C00F3 for ; Wed, 10 Oct 2012 04:24:53 +1100 (EST) Received: from localhost ([::1]:50492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLdY3-0006js-Un for incoming@patchwork.ozlabs.org; Tue, 09 Oct 2012 13:24:51 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLclv-0006eN-Ev for qemu-devel@nongnu.org; Tue, 09 Oct 2012 12:35:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLclA-0008Sd-NL for qemu-devel@nongnu.org; Tue, 09 Oct 2012 12:35:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52400) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLclA-0008Rv-CI for qemu-devel@nongnu.org; Tue, 09 Oct 2012 12:34:20 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q99GYH7q025094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 9 Oct 2012 12:34:17 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q99GWrqJ008429; Tue, 9 Oct 2012 12:34:13 -0400 From: Avi Kivity To: qemu-devel@nongnu.org, Anthony Liguori , liu ping fan , "Michael S. Tsirkin" , Paolo Bonzini , Blue Swirl Date: Tue, 9 Oct 2012 18:32:41 +0200 Message-Id: <1349800368-15228-17-git-send-email-avi@redhat.com> In-Reply-To: <1349800368-15228-1-git-send-email-avi@redhat.com> References: <1349800368-15228-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 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 v3 16/23] memory: move tcg flush into a tcg memory listener 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 We plan to make the core listener listen to all address spaces; this will cause many more flushes than necessary. Prepare for that by moving the flush into a tcg-specific listener. Later we can avoid registering the listener if tcg is disabled. Signed-off-by: Avi Kivity --- exec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index 8b67b8f..cfb8200 100644 --- a/exec.c +++ b/exec.c @@ -3174,7 +3174,7 @@ static void core_begin(MemoryListener *listener) phys_section_watch = dummy_section(&io_mem_watch); } -static void core_commit(MemoryListener *listener) +static void tcg_commit(MemoryListener *listener) { CPUArchState *env; @@ -3228,7 +3228,6 @@ static void io_region_del(MemoryListener *listener, static MemoryListener core_memory_listener = { .begin = core_begin, - .commit = core_commit, .region_add = core_region_add, .region_nop = core_region_nop, .log_global_start = core_log_global_start, @@ -3242,6 +3241,10 @@ static void io_region_del(MemoryListener *listener, .priority = 0, }; +static MemoryListener tcg_memory_listener = { + .commit = tcg_commit, +}; + static void memory_map_init(void) { system_memory = g_malloc(sizeof(*system_memory)); @@ -3256,6 +3259,7 @@ static void memory_map_init(void) memory_listener_register(&core_memory_listener, system_memory); memory_listener_register(&io_memory_listener, system_io); + memory_listener_register(&tcg_memory_listener, system_memory); } MemoryRegion *get_system_memory(void)