From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Stw9x-0000Uu-N2 for qemu-devel@nongnu.org; Wed, 25 Jul 2012 03:37:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Stw9s-00067r-0T for qemu-devel@nongnu.org; Wed, 25 Jul 2012 03:37:29 -0400 Received: from mail-we0-f173.google.com ([74.125.82.173]:48527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Stw9r-000655-Qh for qemu-devel@nongnu.org; Wed, 25 Jul 2012 03:37:23 -0400 Received: by weyz53 with SMTP id z53so303044wey.4 for ; Wed, 25 Jul 2012 00:37:22 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <500FA22F.3010509@redhat.com> Date: Wed, 25 Jul 2012 09:37:19 +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> 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: Stefan Hajnoczi Cc: kvm@vger.kernel.org, Jan Kiszka , Marcelo Tosatti , Liu Ping Fan , qemu-devel@nongnu.org, Avi Kivity , Anthony Liguori Il 25/07/2012 09:03, Stefan Hajnoczi ha scritto: > From: Liu Ping Fan > > iohandler/bh/timer may use DeviceState when its refcnt=0, 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. See for example how hw/scsi-disk.c bumps the refcount of a request before starting asynchronous I/O and calls unref at the end of the asynchronous I/O callback. Paolo