From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfSJ5-0000IE-6z for qemu-devel@nongnu.org; Thu, 23 May 2013 05:59:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfSJ3-0001bz-Jx for qemu-devel@nongnu.org; Thu, 23 May 2013 05:59:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55321) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfSJ3-0001bC-9O for qemu-devel@nongnu.org; Thu, 23 May 2013 05:59:33 -0400 Message-ID: <519DE876.8030503@redhat.com> Date: Thu, 23 May 2013 11:59:18 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1369133851-1894-1-git-send-email-pbonzini@redhat.com> <1369133851-1894-18-git-send-email-pbonzini@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: peter.maydell@linaro.org, David Gibson , qemu-devel@nongnu.org, jan.kiszka@gmail.com Il 23/05/2013 09:09, liu ping fan ha scritto: >> > void address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf, >> > int len, bool is_write) >> > { >> > - AddressSpaceDispatch *d = as->dispatch; >> > - int l; >> > + hwaddr l; >> > uint8_t *ptr; >> > uint32_t val; >> > - hwaddr page; >> > + hwaddr addr1; >> > MemoryRegionSection *section; >> > >> > 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); >> > + l = len; >> > + section = address_space_translate(as, addr, &addr1, &l, is_write); >> > > Jan's "Rework sub-page handling" patch broke the tlb_set_page > (anything else?) But I think we still need a function based on > address_space_translate to wrap the subpage logic inside and ease the > incoming RCU style. The idea is that address_space_translate gets a ref to the MemoryRegion, and the ref is then released by the caller of address_space_translate. That means that the actual memory accesses can run outside the RCU critical section. But I'm not sure how that is related to subpage logic. Subpages are simply MemoryRegions that only exist in the phys page map, rather than within an AddressSpace. Their destruction will be delayed anyway by doing call_rcu on the old phys page map. Paolo