From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Us6Ah-0001Vs-U7 for qemu-devel@nongnu.org; Thu, 27 Jun 2013 02:59:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Us6Ag-0002ZO-VB for qemu-devel@nongnu.org; Thu, 27 Jun 2013 02:59:11 -0400 Received: from mail-bk0-x231.google.com ([2a00:1450:4008:c01::231]:62837) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Us6Ag-0002ZG-Pb for qemu-devel@nongnu.org; Thu, 27 Jun 2013 02:59:10 -0400 Received: by mail-bk0-f49.google.com with SMTP id mz10so111694bkb.8 for ; Wed, 26 Jun 2013 23:59:09 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51CBE2B7.7020904@redhat.com> Date: Thu, 27 Jun 2013 08:59:03 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1372181916-4676-1-git-send-email-pingfank@linux.vnet.ibm.com> <51C9379C.80605@redhat.com> <51C94C90.8000104@redhat.com> <51CA8B63.6000501@redhat.com> <51CAA8A2.6060609@redhat.com> <51CABA88.7040809@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/3] make bh safe with hot-unplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: qemu-devel@nongnu.org, Stefan Hajnoczi Il 27/06/2013 04:08, liu ping fan ha scritto: >> > qdev_free is triggered by the guest, but free is a misnomer. It is >> > really "make it inaccessible from the guest and management" (the kernel >> > equivalent would be removal of /dev and /sys entries, for example). The >> > actual "free" will happen later. > > Without seeing your detail design, but I suggest that leaving the > "exit" as it is, and pick out the inaccessible related code to > removal. We already have a reclamation point, it is instance_finalize. I posted a series a few weeks ago ("[PATCH 00/39] Delay destruction of memory regions to instance_finalize"). > Finally, when refcnt->0, exit is called, and it play as the > final sync point for the remaining access. It is the guest that determines when to start the removal phase. That's qdev_free. refcnt = 0 means that the memory is inaccessible to the guest, and that's when the reclamation phase is started (asynchronously: the instance_finalize callback is actually called at the end of the RCU grace period). Paolo