From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUggY-0000bD-6U for qemu-devel@nongnu.org; Wed, 16 May 2012 12:02:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SUggP-0001yG-Nq for qemu-devel@nongnu.org; Wed, 16 May 2012 12:02:45 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:34524) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUggP-0001xk-Hi for qemu-devel@nongnu.org; Wed, 16 May 2012 12:02:37 -0400 Received: by pbbro12 with SMTP id ro12so1656422pbb.4 for ; Wed, 16 May 2012 09:02:35 -0700 (PDT) Message-ID: <4FB3CF96.7080402@codemonkey.ws> Date: Wed, 16 May 2012 11:02:30 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1337095599-28836-1-git-send-email-anthony.perard@citrix.com> <1337095599-28836-2-git-send-email-anthony.perard@citrix.com> <20120515205222.GA12039@redhat.com> <4FB38E2E.5000508@redhat.com> In-Reply-To: <4FB38E2E.5000508@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/4] Introduce a new hotplug state: Force eject. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Anthony PERARD , Xen Devel , "Michael S. Tsirkin" , QEMU-devel , Stefano Stabellini On 05/16/2012 06:23 AM, Paolo Bonzini wrote: > Il 16/05/2012 13:15, Anthony PERARD ha scritto: >>>> qdev_unplug(&(d->qdev), NULL); >>>> + qdev_free(&(d->qdev)); >>>> } >>>> } >>>> >>>> >>>> Anthony, can you confirm that this solves the problem for you? >> This work until I try to hotplug a new device to the guest at wish >> point I have this: >> ERROR:/local/home/anthony/work/qemu/qom/object.c:389:object_delete: >> assertion failed: (obj->ref == 0) >> >> This is because there is still a pending request of the hotunplug in >> the acpi piix4. >> If I call qdev_free without qdev_unplug, I hit the same assert, but >> rigth away. This is way something new. > > Because it's missing the object_unparent done by qdev_unplug. Does > object_unparent+qdev_free work? (I believe object_unparent should be > done by qdev_free rather than qdev_unplug, but that's something for 1.2). qdev_free() is trivially object_delete today. What we should do is make an object_destroy() which emits a destroy event and then decrements the reference count. When ref == 0, we should emit a delete event. We could then register a slot to object_unparent in the destroy event handler, and then object_new() could register a free handler in the delete event. Then object_delete()/qdev_free() just become trivial invocations of object_unref(). But for 1.1, we definitely should just do an explicit object_unparent(). Regards, Anthony Liguori > > Paolo