From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcRbd-0001fC-Gc for qemu-devel@nongnu.org; Sat, 24 Nov 2012 21:06:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TcRbc-0004uB-1E for qemu-devel@nongnu.org; Sat, 24 Nov 2012 21:06:01 -0500 Received: from mail-ie0-f173.google.com ([209.85.223.173]:33369) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcRbb-0004u7-Sr for qemu-devel@nongnu.org; Sat, 24 Nov 2012 21:05:59 -0500 Received: by mail-ie0-f173.google.com with SMTP id e13so4511172iej.4 for ; Sat, 24 Nov 2012 18:05:59 -0800 (PST) From: Liu Ping Fan Date: Sun, 25 Nov 2012 10:03:01 +0800 Message-Id: <1353808984-22368-5-git-send-email-qemulist@gmail.com> In-Reply-To: <1353808984-22368-1-git-send-email-qemulist@gmail.com> References: <1353808984-22368-1-git-send-email-qemulist@gmail.com> Subject: [Qemu-devel] [PATCH v7 4/7] memory: introduce local lock for address space List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , gleb@redhat.com, Jan Kiszka , Marcelo Tosatti , Anthony Liguori , Stefan Hajnoczi , Paolo Bonzini From: Liu Ping Fan For those address spaces which want to be able out of big lock, they will be protected by their own local. Signed-off-by: Liu Ping Fan --- memory.c | 1 + memory.h | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/memory.c b/memory.c index 2f68d67..18425fd 100644 --- a/memory.c +++ b/memory.c @@ -1535,6 +1535,7 @@ void memory_listener_unregister(MemoryListener *listener) void address_space_init(AddressSpace *as, MemoryRegion *root) { memory_region_transaction_begin(); + qemu_mutex_init(&as->lock); as->root = root; as->current_map = g_new(FlatView, 1); flatview_init(as->current_map); diff --git a/memory.h b/memory.h index 79393f1..13a9e3e 100644 --- a/memory.h +++ b/memory.h @@ -22,6 +22,7 @@ #include "cpu-common.h" #include "targphys.h" #include "qemu-queue.h" +#include "qemu-thread.h" #include "iorange.h" #include "ioport.h" #include "int128.h" @@ -164,6 +165,7 @@ typedef struct AddressSpace AddressSpace; */ struct AddressSpace { /* All fields are private. */ + QemuMutex lock; const char *name; MemoryRegion *root; struct FlatView *current_map; @@ -801,6 +803,7 @@ void mtree_info(fprintf_function mon_printf, void *f); * * @as: an uninitialized #AddressSpace * @root: a #MemoryRegion that routes addesses for the address space + * @lock: if true, the physmap protected by local lock, otherwise big lock */ void address_space_init(AddressSpace *as, MemoryRegion *root); -- 1.7.4.4