From: Ian Jackson Subject: Re: [PATCH v2 10/10] libxl: add device backend listener in order to launch backends Date: Mon, 18 Nov 2013 14:22:00 +0000 Message-ID: <21130.8840.802607.435942@mariner.uk.xensource.com> References: <1384171831-21275-1-git-send-email-roger.pau@citrix.com> <1384171831-21275-11-git-send-email-roger.pau@citrix.com> <21126.24509.186907.315659@mariner.uk.xensource.com> <5289FE60.2010305@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ViPiR-0007eY-H3 for xen-devel@lists.xenproject.org; Mon, 18 Nov 2013 14:22:15 +0000 In-Reply-To: <5289FE60.2010305@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 v2 10/10] libxl: add device backend l= istener in order to launch backends"): > On 15/11/13 18:54, Ian Jackson wrote: > > I would suggest: rename "skip" to "out". > = > Ack, I don't mind changing it to out. I don't see any flow in which we > could leak the nested_ao right now. Looking at it again I think I was confused. > > Would it be possible to abolish the "free_ao" variable, and to change > > this: > > = > >> + rc =3D add_device(egc, nested_ao, dguest, ddev); > >> + if (rc > 0) > >> + free_ao =3D true; > > = > > To this: > > if (!rc) > > /* device callback requires, and will dispose of, > > * nested_ao; ddev and dguest are linked in */ > > return; > > = > > and always free the ao on ordinary exit ? > = > I'm not sure I follow, if instead of setting free_ao to true I just > return, who is going to free the ddev and dguest if necessary? (note > that the callback is not using ddev or dguest at all) Right. Sorry. > Also, doing it in the callback is not safe, because we are no longer > holding the "Big lock", so we would have to add another lock which I > would prefer to avoid. That's not actually a problem: all the in-libxl callbacks take place with the libxl ctx lock held. But I don't think that's relevant, actually. Acked-by: Ian Jackson Ian.