From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIwRZ-00059F-Ut for qemu-devel@nongnu.org; Tue, 12 Jan 2016 05:44:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIwRW-0005aW-Op for qemu-devel@nongnu.org; Tue, 12 Jan 2016 05:44:53 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:32634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIwRW-0005aR-Is for qemu-devel@nongnu.org; Tue, 12 Jan 2016 05:44:50 -0500 Message-ID: <1452595481.13986.144.camel@oracle.com> From: Knut Omang Date: Tue, 12 Jan 2016 11:44:41 +0100 In-Reply-To: <5686FFAF.3070205@redhat.com> References: <5686FFAF.3070205@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Possible reference leak in device_set_realized(...) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Ilya Lesokhin , "qemu-devel@nongnu.org" Cc: Haggai Eran On Fri, 2016-01-01 at 23:37 +0100, Paolo Bonzini wrote: >=20 > On 31/12/2015 19:13, Ilya Lesokhin wrote: > > I was able to overcome this issue by calling object_unparent on my > > device but I=E2=80=99m not sure that the correct way of fixing it. >=20 > Yes, it's definitely the right way to fix it. Sorry for the late follow-up on this one, but I had to find some more time to spend with the code (and with valgrind too) to understand better/verify what was going on in the qdev/qom layers. In the SR/IOV patch the object is created by pci_create. Since there is no corresponding pci_delete, I assume this means that the correct way to clean up from pci_create is simply a call to object_unparent() as you indicate, and this is what is missing from the patch set. So the full setup/teardown sequence per VF then becomes: pci_create(...) object_unparent(...) Thanks, Knut