From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5tKR-000763-Pu for qemu-devel@nongnu.org; Mon, 27 Aug 2012 03:01:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T5tKO-0001Wa-0W for qemu-devel@nongnu.org; Mon, 27 Aug 2012 03:01:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47340) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5tKN-0001WI-Oo for qemu-devel@nongnu.org; Mon, 27 Aug 2012 03:01:39 -0400 Message-ID: <503B1B4B.6050108@redhat.com> Date: Mon, 27 Aug 2012 09:01:31 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1345801763-24227-1-git-send-email-qemulist@gmail.com> <1345801763-24227-11-git-send-email-qemulist@gmail.com> <503792F1.4090109@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 10/10] qdev: fix create in place obj's life cycle problem List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: Liu Ping Fan , qemu-devel@nongnu.org, Anthony Liguori , Avi Kivity Il 25/08/2012 09:42, liu ping fan ha scritto: >> > >> > I don't see why MMIO dispatch should hold the IDEBus ref rather than the >> > PCIIDEState. >> > > When transfer memory_region_init_io() 3rd para from void* opaque to > Object* obj, the obj : opaque is not neccessary 1:1 map. For such > situation, in order to let MemoryRegionOps tell between them, we > should pass PCIIDEState->bus[0], bus[1] separately. The rule should be that the obj is the object that you want referenced, and that should be the PCIIDEState. But this is anyway moot because it only applies to objects that are converted to use unlocked dispatch. This likely will not be the case for IDE. Paolo >> > In the case of the PIIX, the BARs are set up by the PCIIDEState in >> > bmdma_setup_bar (called by bmdma_setup_bar). >> > > Supposing we have convert PCIIDEState->bmdma[0]/[1] to Object. And in > mmio-dispatch, object_ref will impose on bmdma[0/[1], but this can not > prevent PCIIDEState->refcnt=0, and then the whole object disappear!