From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQZXj-00085i-JW for qemu-devel@nongnu.org; Fri, 12 Apr 2013 04:41:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQZXi-0005Ze-GT for qemu-devel@nongnu.org; Fri, 12 Apr 2013 04:41:11 -0400 Received: from mail-we0-x22c.google.com ([2a00:1450:400c:c03::22c]:59563) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQZXi-0005ZU-9J for qemu-devel@nongnu.org; Fri, 12 Apr 2013 04:41:10 -0400 Received: by mail-we0-f172.google.com with SMTP id r3so1873539wey.17 for ; Fri, 12 Apr 2013 01:41:09 -0700 (PDT) Date: Fri, 12 Apr 2013 10:41:06 +0200 From: Stefan Hajnoczi Message-ID: <20130412084106.GD31055@stefanha-thinkpad.redhat.com> References: <1364804434-7980-1-git-send-email-qemulist@gmail.com> <1364804434-7980-4-git-send-email-qemulist@gmail.com> <20130411101527.GD9165@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 3/5] vring: use hostmem's RAM safe api List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: Peter Maydell , Anthony Liguori , Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, Vasilis Liaskovitis , Paolo Bonzini On Fri, Apr 12, 2013 at 12:49:45PM +0800, liu ping fan wrote: > On Thu, Apr 11, 2013 at 6:15 PM, Stefan Hajnoczi wrote: > > On Mon, Apr 01, 2013 at 04:20:32PM +0800, Liu Ping Fan wrote: > >> @@ -51,7 +50,7 @@ bool vring_setup(Vring *vring, VirtIODevice *vdev, int n) > >> > >> void vring_teardown(Vring *vring) > >> { > >> - hostmem_finalize(&vring->hostmem); > >> + memory_region_unref(vring->vring_mr); > >> } > > > > dataplane keeps a reference to the vring. This prevents memory hot > > unplug while the device is up. If this is a problem we'll have to > > reduce the lifespan of the vring mapping. > > > hot unplug is rare case, maybe we can ignore the delay of device's finalize. I thought about the vring more and I think we can keep the current behavior. dataplane keeps the vring up when the device is active. When the guest kernel/device driver resets the device then we unmap the vring. It's reasonable that the guest needs to release the virtio device before hot unplugging memory used for the vring :). Therefore, in practice this behavior should be fine. Stefan