From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtTTj-0001aC-MU for qemu-devel@nongnu.org; Fri, 03 Feb 2012 19:27:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RtTTi-0001Y0-Ii for qemu-devel@nongnu.org; Fri, 03 Feb 2012 19:27:43 -0500 Received: from mail-we0-f173.google.com ([74.125.82.173]:44627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtTTi-0001Xr-AB for qemu-devel@nongnu.org; Fri, 03 Feb 2012 19:27:42 -0500 Received: by werh12 with SMTP id h12so3690004wer.4 for ; Fri, 03 Feb 2012 16:27:41 -0800 (PST) Sender: Paolo Bonzini Message-ID: <4F2C7B7B.60801@redhat.com> Date: Sat, 04 Feb 2012 01:27:39 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1328201142-26145-1-git-send-email-pbonzini@redhat.com> <1328201142-26145-2-git-send-email-pbonzini@redhat.com> <4F2BEED5.3050904@codemonkey.ws> In-Reply-To: <4F2BEED5.3050904@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 01/16] qdev: fix hot-unplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org On 02/03/2012 03:27 PM, Anthony Liguori wrote: > On 02/02/2012 10:45 AM, Paolo Bonzini wrote: >> The reference that is returned by qdev_device_add is never given >> back, so that device_del does not cause the refcount to go to zero >> (and thus does nothing). >> >> Signed-off-by: Paolo Bonzini > > This isn't needed in qom-upstream.14. Here's why: > > object_init does not increase the reference count > > object_property_add_child increases the reference count > object_new increases the reference count > > object_delete decrements the reference count > object_property_del_child decreases the reference count > > object_delete calls object_property_del_child(obj->parent, obj) > > qdev_device_add calls object_new and object_property_add_child > -> ref == 2 > > qdev_device_del calls object_delete > -> ref -= 2 > > In qom-upstream.13, object_delete wasn't calling > object_property_del_child which is why you saw the behavior you did. > This problem would still exist with a composed device so dropping the > reference here isn't enough. I trust you for now. :) It really seems like my patch is obviously correct so, if it's not needed anymore there may be another bug elsewhere that masks it. Paolo