From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTwyc-0007B6-Gr for qemu-devel@nongnu.org; Thu, 01 Nov 2012 11:46:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTwyW-0005VK-KZ for qemu-devel@nongnu.org; Thu, 01 Nov 2012 11:46:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44943) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTwyW-0005V3-Au for qemu-devel@nongnu.org; Thu, 01 Nov 2012 11:46:32 -0400 Message-ID: <50929945.1080002@redhat.com> Date: Thu, 01 Nov 2012 17:46:13 +0200 From: Avi Kivity MIME-Version: 1.0 References: <1351468127-15025-1-git-send-email-pingfank@linux.vnet.ibm.com> <1351468127-15025-7-git-send-email-pingfank@linux.vnet.ibm.com> <508E4F61.7070103@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [patch v5 6/8] memory: make mmio dispatch able to be out of biglock List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: Peter Maydell , Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, Anthony Liguori , Stefan Hajnoczi , Paolo Bonzini On 10/30/2012 09:06 AM, liu ping fan wrote: >>> while (len > 0) { >>> page = addr & TARGET_PAGE_MASK; >>> l = (page + TARGET_PAGE_SIZE) - addr; >>> if (l > len) >>> l = len; >>> - section = phys_page_find(d, page >> TARGET_PAGE_BITS); >>> + >>> + if (as->lock) { >>> + qemu_mutex_lock(as->lock); >>> + safe_ref = memory_region_section_lookup_ref(d, page, &obj_mrs); >>> + qemu_mutex_unlock(as->lock); >>> + if (!safe_ref) { >>> + qemu_mutex_lock_iothread(); >>> + qemu_mutex_lock(as->lock); >>> + /* when 2nd try, mem map can change, need to judge it again */ >>> + safe_ref = memory_region_section_lookup_ref(d, page, &obj_mrs); >>> + qemu_mutex_unlock(as->lock); >>> + if (safe_ref) { >>> + qemu_mutex_unlock_iothread(); >>> + } >>> + } >>> + } else { >>> + /* Caller hold the big lock */ >>> + memory_region_section_lookup_ref(d, page, &obj_mrs); >> >> It's not a property of the address space, it's a property of the caller. >> > Sorry, what is your meaning? Whether the caller holds the big lock or not is not known by the address space. It is only known by the caller itself. -- error compiling committee.c: too many arguments to function