From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBMDh-0005E9-KV for qemu-devel@nongnu.org; Tue, 22 Dec 2015 07:39:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBMDc-00005Y-G9 for qemu-devel@nongnu.org; Tue, 22 Dec 2015 07:39:13 -0500 Received: from [59.151.112.132] (port=32502 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBMDc-0008WD-4E for qemu-devel@nongnu.org; Tue, 22 Dec 2015 07:39:08 -0500 References: <1450436632-23980-1-git-send-email-caoj.fnst@cn.fujitsu.com> <1450436632-23980-4-git-send-email-caoj.fnst@cn.fujitsu.com> <56744A11.3030405@redhat.com> <56769336.9050104@cn.fujitsu.com> <56781F82.3060603@redhat.com> <5678CA5D.8070002@cn.fujitsu.com> <5678FCEC.10500@gmail.com> <567914E4.2020400@cn.fujitsu.com> <56791975.5050608@redhat.com> From: Cao jin Message-ID: <56791D54.9080402@cn.fujitsu.com> Date: Tue, 22 Dec 2015 17:52:20 +0800 MIME-Version: 1.0 In-Reply-To: <56791975.5050608@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/5] PXB: convert to realize() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum Cc: Paolo Bonzini , qemu-devel@nongnu.org, mst@redhat.com On 12/22/2015 05:35 PM, Marcel Apfelbaum wrote: > On 12/22/2015 11:16 AM, Cao jin wrote: >> >> >> On 12/22/2015 03:34 PM, Marcel Apfelbaum wrote: >>> On 12/22/2015 05:58 AM, Cao jin wrote: >>>> >>>> >>>> On 12/21/2015 11:49 PM, Paolo Bonzini wrote: >>>>> >>>>> >>>>> On 20/12/2015 12:38, Cao jin wrote: >>>>>>>> >>>>>>>> + object_unref(OBJECT(ds)); >>>>>>>> + object_unref(OBJECT(bds)); >>>>>>>> + object_unref(OBJECT(bus)); >>>>>>> >>>>>>> I think these should be object_unparent, not unref. >>>>>>> >>>>>> >>>>>> But, it seems these 3 objects isn`t added as a child-property via >>>>>> object_property_add_child() during creation, so OBJECT(ds)->parent(so >>>>>> does the other 2) will be NULL, and so object_unparent will do >>>>>> nothing? >>>>> >>>>> qdev_init_nofail adds them (qdev_init_nofail -> >>>>> object_property_set_bool >>>>> -> device_set_realized -> object_property_add_child). >>>>> >>>>> If you haven't reached qdev_init_nofail, you should indeed unref ds >>>>> and >>>>> bds instead. However, the bus should be unparented because >>>>> pci_bus_new >>>>> makes it a child of ds (pci_bus_new -> qbus_create -> qbus_realize -> >>>>> object_property_add_child). >>>>> >>>> >>>> Yes...that`s true. >>>> >>>> and @Marcel, I think maybe this is final decision? >>> >>> >>> I say add a debug trace line before pxb_register_bus (or use the >>> debugger) >>> and check ds->parent, bds->parent and bus->parent. >>> >> >> uh..sorry I don`t get it, what does the debug trace line/use debugger >> mean? >> >>> Run the qemu with -device pxb,bus=80,... and for every one that its >>> parent >>> is not null add unparent. :) >> >> don`t get it too, could you detail it? > > > Sure, just add something like: > > fprintf(stderr, "ds parent: %p, bus parent... ", ds->parent ...) > > Compile and run QEMU with a pxb device: > -device pxb,bus=80,... > > And look for which object has a parent :) > Oh... my bad understanding:p I see now. I thought maybe you mean like this;) if (bds->parent) object_unparent(bds); else object_unref(bds) > Thanks, > Marcel > >> >>> >>> Thanks, >>> Marcel >>> >>> >>> >>> >>>> >>>>> Paolo >>>>> >>>>> >>>>> . >>>>> >>>> >>> >>> >>> >>> >> > > > > > -- Yours Sincerely, Cao Jin