From patchwork Wed Jun 27 16:27:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 167707 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 C9BE21009C7 for ; Thu, 28 Jun 2012 02:29:24 +1000 (EST) Received: from localhost ([::1]:45382 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sjv7K-00033v-IX for incoming@patchwork.ozlabs.org; Wed, 27 Jun 2012 12:29:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sjv73-0002rh-T8 for qemu-devel@nongnu.org; Wed, 27 Jun 2012 12:29:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sjv6x-0002w7-Lu for qemu-devel@nongnu.org; Wed, 27 Jun 2012 12:29:05 -0400 Received: from thoth.sbs.de ([192.35.17.2]:21688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sjv6x-0002vO-C6 for qemu-devel@nongnu.org; Wed, 27 Jun 2012 12:28:59 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id q5RGSNX8028766; Wed, 27 Jun 2012 18:28:23 +0200 Received: from mchn199C.mchp.siemens.de ([139.22.42.91]) by mail1.siemens.de (8.13.6/8.13.6) with SMTP id q5RGRaFg016003; Wed, 27 Jun 2012 18:28:13 +0200 From: Jan Kiszka To: Anthony Liguori , qemu-devel Date: Wed, 27 Jun 2012 18:27:26 +0200 Message-Id: X-Mailer: git-send-email 1.7.3.4 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.2 Cc: Liu Ping Fan , Avi Kivity , kvm , Marcelo Tosatti Subject: [Qemu-devel] [PATCH v2 4/7] memory: Fold memory_region_update_topology into memory_region_transaction_commit 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 Simplify the code as we are using now only a subset of the original features of memory_region_update_topology. Signed-off-by: Jan Kiszka --- memory.c | 39 +++++++++++---------------------------- 1 files changed, 11 insertions(+), 28 deletions(-) diff --git a/memory.c b/memory.c index 8b1218e..902a8c1 100644 --- a/memory.c +++ b/memory.c @@ -24,7 +24,6 @@ #include "exec-obsolete.h" unsigned memory_region_transaction_depth = 0; -static bool memory_region_update_pending = false; static bool global_dirty_log = false; static QTAILQ_HEAD(memory_listeners, MemoryListener) memory_listeners @@ -732,31 +731,6 @@ static void address_space_update_topology(AddressSpace *as) address_space_update_ioeventfds(as); } -static void memory_region_update_topology(MemoryRegion *mr) -{ - if (memory_region_transaction_depth) { - memory_region_update_pending |= !mr || mr->enabled; - return; - } - - if (mr && !mr->enabled) { - return; - } - - MEMORY_LISTENER_CALL_GLOBAL(begin, Forward); - - if (address_space_memory.root) { - address_space_update_topology(&address_space_memory); - } - if (address_space_io.root) { - address_space_update_topology(&address_space_io); - } - - MEMORY_LISTENER_CALL_GLOBAL(commit, Forward); - - memory_region_update_pending = false; -} - void memory_region_transaction_begin(void) { ++memory_region_transaction_depth; @@ -766,8 +740,17 @@ void memory_region_transaction_commit(void) { assert(memory_region_transaction_depth); --memory_region_transaction_depth; - if (!memory_region_transaction_depth && memory_region_update_pending) { - memory_region_update_topology(NULL); + if (!memory_region_transaction_depth) { + MEMORY_LISTENER_CALL_GLOBAL(begin, Forward); + + if (address_space_memory.root) { + address_space_update_topology(&address_space_memory); + } + if (address_space_io.root) { + address_space_update_topology(&address_space_io); + } + + MEMORY_LISTENER_CALL_GLOBAL(commit, Forward); } }