From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ua0WN-000241-Jc for qemu-devel@nongnu.org; Wed, 08 May 2013 05:18:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ua0WJ-0006Gp-JK for qemu-devel@nongnu.org; Wed, 08 May 2013 05:18:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ua0WJ-0006G2-Ar for qemu-devel@nongnu.org; Wed, 08 May 2013 05:18:43 -0400 Date: Wed, 8 May 2013 11:18:40 +0200 From: Stefan Hajnoczi Message-ID: <20130508091840.GF16581@stefanha-thinkpad.muc.redhat.com> References: <1367850321-1732-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1367850321-1732-1-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH 0/8] MemoryRegion and FlatView refcounting, replace hostmem with memory_region_find List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: jan.kiszka@siemens.com, qemu-devel@nongnu.org, qemulist@gmail.com On Mon, May 06, 2013 at 04:25:13PM +0200, Paolo Bonzini wrote: > this is an alternative approach to refactoring of dataplane's HostMem > code. Here, I take Ping Fan's idea of RCU-style updating of the > region list and apply it to the AddressSpace's FlatView. With this > change, dataplane can simply use memory_region_find instead of > hostmem. > > This is a somewhat larger change, but I prefer it for two reasons. > > 1) it splits the task of adding BQL-less memory dispatch in two parts, > tacking memory_region_find first (which is simpler because locking > is left to the caller). > > 2) HostMem duplicates a lot of the FlatView logic, and adding the > RCU-style update in FlatView benefits everyone. > > The missing ingredients here are: > > 1) remember and unreference the MemoryRegions that are used in > a vring entry. In order to implement this, it is probably simpler > to change vring.c to use virtio.c's VirtQueueElement data structure. > We want something like that anyway in order to support migration. Agreed. I want to drop vring.c and have virtio.c use thread-safe APIs so it can be used from dataplane. VirtQueueElement can hide the MemoryRegion reference so the virtio device caller (net, block, etc) doesn't need to juggle references manually. > 2) add an owner field to MemoryRegion, and set it for all MemoryRegions > for hot-unpluggable devices. In this series, ref/unref are stubs. > > For simplicity I based the patches on my IOMMU rebase. I placed the > tree at git://github.com/bonzini/qemu.git, branch iommu. Are you hoping that Ping Fan will pick up this RFC or will you push it yourself? Either way, I'm very interested in a thread-safe memory API. Stefan