From: Ian Jackson Subject: Re: [PATCH v1 12/12] libxl: add device backend listener in order to launch backends Date: Mon, 11 Nov 2013 11:37:42 +0000 Message-ID: <21120.49542.493981.635753@mariner.uk.xensource.com> References: <1380705874-58491-1-git-send-email-roger.pau@citrix.com> <1380705874-58491-13-git-send-email-roger.pau@citrix.com> <21105.15127.428243.701439@mariner.uk.xensource.com> <5277D362.4040300@citrix.com> <21111.55145.501074.162529@mariner.uk.xensource.com> <527A0EE3.1040603@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VfpoR-00078H-54 for xen-devel@lists.xenproject.org; Mon, 11 Nov 2013 11:37:47 +0000 In-Reply-To: <527A0EE3.1040603@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Roger Pau =?iso-8859-1?Q?Monn=E9?= Cc: xen-devel@lists.xenproject.org, Ian Campbell List-Id: xen-devel@lists.xenproject.org Roger Pau Monn=E9 writes ("Re: [PATCH v1 12/12] libxl: add device backend l= istener in order to launch backends"): > On 04/11/13 18:20, Ian Jackson wrote: > > But what you actually do is call initiate_device_remove and then > > return - ie, you return to the event loop. That gives up the lock, > > obviously. So while the device removal is proceeding, other events > > can occur. > > = > > If backend_watch_callback happens then, I think you may find that it > > seems num_*=3D=3D0 and decides to tear down the state for that domain. > = > The cleanup for the domain already happened, after we decrement num_* we > return to the main backend_watch_callback (all holding the Big Lock), > and libxl proceeds with the removal of the libxl__ddomain_guest if > sum(num_*) =3D=3D 0. Ah, yes. So the teardown of the domain tracking structure happens right away. The device removal callback happens after libxl has forgotten about the domain. > device_complete doesn't make use of either libxl__ddomain_device or > libxl__ddomain_guest, during normal program flow device_complete will be > called with both of the above data structures already freed. Yes. Mind you, in the future, if we get better error handling, this is going to have to be redone. But you've convinced me it's OK for now. Ian.