From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TheEz-0001JP-Tu for qemu-devel@nongnu.org; Sun, 09 Dec 2012 05:36:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TheEx-0004l0-AA for qemu-devel@nongnu.org; Sun, 09 Dec 2012 05:36:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60783) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TheEx-0004ku-2L for qemu-devel@nongnu.org; Sun, 09 Dec 2012 05:36:07 -0500 Date: Sun, 9 Dec 2012 11:36:01 +0100 From: Stefan Hajnoczi Message-ID: <20121209103601.GA10019@stefanha-thinkpad.redhat.com> References: <1354740430-22452-1-git-send-email-stefanha@redhat.com> <1354740430-22452-4-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v5 03/11] dataplane: add host memory mapping code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: Kevin Wolf , Anthony Liguori , "Michael S. Tsirkin" , qemu-devel@nongnu.org, Blue Swirl , khoa@us.ibm.com, Paolo Bonzini , asias@redhat.com On Sun, Dec 09, 2012 at 12:02:52PM +0800, liu ping fan wrote: > On Thu, Dec 6, 2012 at 4:47 AM, Stefan Hajnoczi wrote: > > +void hostmem_init(Hostmem *hostmem) > > +{ > > + memset(hostmem, 0, sizeof(*hostmem)); > > + > > + hostmem->listener = (MemoryListener){ > > + .begin = hostmem_listener_dummy, > > + .commit = hostmem_listener_commit, > > I think, here, if we sync on big lock, and flush out dangling pointer > in data-plane thread, then we can survive from the unplug. Hot unplug support requires that the data plane thread completes all requests and doesn't process any new requests until the critical region completes (e.g. hot memory unplug). vm_stop() + bdrv_drain_all() achieves this: 1. vcpus are stopped so no new requests can be submitted by the guest. 2. bdrv_drain_all() completes all Linux AIO requests so we're no longer accessing guest memory. vcpus should be enabled again after hot unplug. > > + .region_add = hostmem_listener_append_region, > > + .region_del = hostmem_listener_section_dummy, > > And here we should remove the corresponding info in hostmem .region_del() is not necessary because we rebuild a fresh memory region list. We never update the memory region list once it has been installed. This means the .region_add() and .region_nop() information is enough to build a fresh list from scratch. Stefan