From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLbm1-0006BY-2U for qemu-devel@nongnu.org; Mon, 16 Sep 2013 12:35:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLblr-0008Hv-Mt for qemu-devel@nongnu.org; Mon, 16 Sep 2013 12:35:40 -0400 Received: from mail-yh0-x232.google.com ([2607:f8b0:4002:c01::232]:49835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLblr-0008Hr-F4 for qemu-devel@nongnu.org; Mon, 16 Sep 2013 12:35:31 -0400 Received: by mail-yh0-f50.google.com with SMTP id a41so2145362yho.37 for ; Mon, 16 Sep 2013 09:35:31 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5237335D.4080104@redhat.com> Date: Mon, 16 Sep 2013 18:35:41 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1378211609-16121-1-git-send-email-pbonzini@redhat.com> In-Reply-To: <1378211609-16121-1-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 00/38] Delay destruction of memory regions to instance_finalize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mst@redhat.com Cc: qemu-devel@nongnu.org Il 03/09/2013 14:32, Paolo Bonzini ha scritto: > QOM splits the destruction of a device in two phases: > > - unrealize, also known as "exit" from qdev times, should isolate > the device from the guest. After unrealize returns, the guest > should not be able to issue new requests. > > - instance_finalize will reclaim the memory. This is only called > after all requests terminate and drop the references on the > device. > > Though overlooked, this is important even now: QEMU's little secret is > that devices already do access memory out of the iothread mutex (with > address_space_map/unmap and AIO), and this can be MMIO memory too > through a bounce buffer. This series prepares things so that, once > we'll put the memory_region_ref/unref infrastructure to complete use, > things will just work. > > Of course this split will be particularly important for devices that > will be able to do unlocked MMIO. > > This series changes all PCI devices (the sole to support hotplug _and_ > use MemoryRegions) to do memory_region_del_subregion at unrealize time, > and memory_region_destroy at instance_finalize time. As it is mostly > a PCI patch, it should go through mst's tree. Ping. Paolo