From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StwrX-0007wy-67 for qemu-devel@nongnu.org; Wed, 25 Jul 2012 04:22:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1StwrR-0000vh-FP for qemu-devel@nongnu.org; Wed, 25 Jul 2012 04:22:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26253) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StwrR-0000uX-7O for qemu-devel@nongnu.org; Wed, 25 Jul 2012 04:22:25 -0400 Message-ID: <500FACB9.70209@redhat.com> Date: Wed, 25 Jul 2012 10:22:17 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1343187070-27371-1-git-send-email-qemulist@gmail.com> <1343187070-27371-5-git-send-email-qemulist@gmail.com> <500FA22F.3010509@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 4/5] qom: delay DeviceState's reclaim to main-loop List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: kvm@vger.kernel.org, Stefan Hajnoczi , Marcelo Tosatti , qemu-devel@nongnu.org, Avi Kivity , Anthony Liguori , Jan Kiszka Il 25/07/2012 10:16, liu ping fan ha scritto: > > It's not clear how to me. The only reference to devices from an > > iohandler/bh/timer can be in the opaque. Now, if you have a > > iohandler/bh/timer whose opaque is a DeviceState, you should bump the > > refcount before setting it up, and unref after tearing it down. > > Yes, I admit refcnt is a good solution, but I think it means that we > will fix it with each device's bh. And this way seems lazy. Most of the time the bh/timer/iohandler is created in the init function, and deleted in the exit function, so in this case the lifecycle is even easier to manage. Looking at your patch again, it seems like you're implementing a poor-man RCU. So that's fine for a proof-of-concept, but let's replace it with real RCU sooner or later. Paolo