From: Ian Campbell Subject: Re: [PATCH] fix assert fail in libxl__sigchld_installhandler Date: Mon, 25 Nov 2013 16:52:20 +0000 Message-ID: <1385398340.22002.97.camel@kazak.uk.xensource.com> References: <1385371124-14474-1-git-send-email-bjzhang@suse.com> <21139.15057.494878.849372@mariner.uk.xensource.com> <1385380797.22002.45.camel@kazak.uk.xensource.com> <21139.32271.37040.363443@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <21139.32271.37040.363443@mariner.uk.xensource.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: Ian Jackson Cc: jfehlig@suse.com, xen-devel@lists.xen.org, Bamvor Jian Zhang List-Id: xen-devel@lists.xenproject.org On Mon, 2013-11-25 at 16:42 +0000, Ian Jackson wrote: > Ian Campbell writes ("Re: [PATCH] fix assert fail in libxl__sigchld_installhandler"): > > On Mon, 2013-11-25 at 11:56 +0000, Ian Jackson wrote: > ... > > > If you are running multiple different long-running libxl operations in > > > parallel, then either: > > > (a) they must all use the same libxl ctx > > > or > > > (b) you must specify libxl_sigchld_owner_mainloop and demultiplex > > > SIGCHLD yourself > > > > I was going to ask if it were valid to use > > libxl_sigchld_owner_libxl_always for one ctx and > > libxl_sigchld_owner_mainloop for all the others (in essence delegating > > the requirements of _mainloop to the one special ctx). The answer is no, > > due to the requirement for users of _mainloop to call > > libxl_childproc_exited, which _libxl_always does not do for you, > > certainly not for other ctxts. > > I guess you _could_ do that, actually. > > What you would do is provide a reaped_callback to the _libxl_always > ctx. And in that callback, you would iterate over all your other ctxs > calling libxl_childproc_reaped. > > The locking would be tricky. > > Hmm. I guess you could have a special libxl ctx whose only purpose > was to deal with the sigchld. Then its lock would be outside the lock > protecting your list of contexts, and outside all of your libxl locks, > and the reaped_callback could just do the obvious thing. You would > have to call libxl_event_wait on that ctx on some thread. > > Is it best not to mention these possibilities ? I think so! > > Ian.