From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrO4f-00080S-LA for qemu-devel@nongnu.org; Tue, 25 Jun 2013 03:54:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UrO4e-0003Ah-Gt for qemu-devel@nongnu.org; Tue, 25 Jun 2013 03:54:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46313) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrO4e-0003AD-9n for qemu-devel@nongnu.org; Tue, 25 Jun 2013 03:54:00 -0400 Message-ID: <51C94C90.8000104@redhat.com> Date: Tue, 25 Jun 2013 09:53:52 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1372181916-4676-1-git-send-email-pingfank@linux.vnet.ibm.com> <51C9379C.80605@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/3] make bh safe with hot-unplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: qemu-devel@nongnu.org, Stefan Hajnoczi Il 25/06/2013 08:32, liu ping fan ha scritto: > On Tue, Jun 25, 2013 at 2:24 PM, Paolo Bonzini wrote: >> Il 25/06/2013 19:38, Liu Ping Fan ha scritto: >>> This series relies on refcnt of object used by bh callback to run against unplug. >>> >>> Open issue: >>> Another choice may be rcu, but I think some issues are hard to resolve. >>> Using rcu, we have two choice: >>> when holding object refcnt, call qemu_bh_delete(); then after grace period, we can release. >>> Or making qemu_bh_delete() sync in the path of DeviceState's finalization. >> >> What do you mean exactly? qemu_bh_delete() is async, but it operates on >> dynamically-allocated memory. >> > Before DeviceState is freed, we should make sure the bh is delete, and > not related bh is in fly. The bh need not be deleted. It just needs to be not-scheduled (easy, qemu_bh_delete does that) and not running. The latter part could be the hard one in a multi-threaded context, but I think it's up to the device to ensure it. It doesn't _have_ to be hard. For example, joining the data-plane thread would do that as well. Paolo >> Paolo >> >>> but currently, the callers of qemu_bh_delete() can not satisfy any of the two condition. >>