From patchwork Mon Nov 5 05:38:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: pingfan liu X-Patchwork-Id: 197151 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 832732C0093 for ; Mon, 5 Nov 2012 17:13:13 +1100 (EST) Received: from localhost ([::1]:37638 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVFPU-0008Og-Pi for incoming@patchwork.ozlabs.org; Mon, 05 Nov 2012 00:39:44 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46342) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVFPD-0008FD-Vm for qemu-devel@nongnu.org; Mon, 05 Nov 2012 00:39:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TVFPC-0005hC-Ar for qemu-devel@nongnu.org; Mon, 05 Nov 2012 00:39:27 -0500 Received: from mail-ob0-f173.google.com ([209.85.214.173]:37662) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVFPC-0005Ov-5b for qemu-devel@nongnu.org; Mon, 05 Nov 2012 00:39:26 -0500 Received: by mail-ob0-f173.google.com with SMTP id wc18so4916290obb.4 for ; Sun, 04 Nov 2012 21:39:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=X7aDL+5rFIcVmmkKL9BhVaKi9SjYU/pu8uvDgzz7q9Q=; b=fVB6E48+ccSRLH+0O3T6pf+oFy5VQ7pktdLI0FHfVXhb6tTdCDBvgAue1uWsipnBtD zbBQB3E2OX0QDEwDYiwuSxvRVM4RHwA9qD8VPy9b909EzWDPxmM2TxFRYEhfP7R/eBlQ XBQoSUJKnxmhjH2lQbZIkqncQGizJ9/zEqXfpQ2Xzyff+RZn0SpiNfnIDsdgAmNcoaEq bNC0i/B74Wrzhk0LxUlRRSUndzJcEN05PP9lY3FVNUKG19MAcqqgsrmek73oP+7zgTQ6 i0xjT0RvqFndf7VTjZgpx4A96r+r82XQ9iu7Ywf244XQeYBFQoJZY3tVHMDzHV3S1ik+ INnw== Received: by 10.60.21.193 with SMTP id x1mr6858593oee.142.1352093965900; Sun, 04 Nov 2012 21:39:25 -0800 (PST) Received: from localhost ([202.108.130.138]) by mx.google.com with ESMTPS id q1sm13191722oeh.8.2012.11.04.21.39.23 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 04 Nov 2012 21:39:25 -0800 (PST) From: Liu Ping Fan To: qemu-devel@nongnu.org Date: Mon, 5 Nov 2012 13:38:41 +0800 Message-Id: <1352093924-17598-6-git-send-email-qemulist@gmail.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1352093924-17598-1-git-send-email-qemulist@gmail.com> References: <1352093924-17598-1-git-send-email-qemulist@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.214.173 Cc: Peter Maydell , Jan Kiszka , Marcelo Tosatti , Avi Kivity , Anthony Liguori , Stefan Hajnoczi , Paolo Bonzini Subject: [Qemu-devel] [PATCH v6 5/8] memory: introduce local lock for address space 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 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);