From: Ian Jackson Subject: Re: [PATCH 0/2] question on libxl ao [and 1 more messages] Date: Tue, 5 Nov 2013 16:05:10 +0000 Message-ID: <21113.5942.487235.634777@mariner.uk.xensource.com> References: <1383643331-6703-1-git-send-email-bjzhang@suse.com> <1383643331-6703-2-git-send-email-bjzhang@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1383643331-6703-1-git-send-email-bjzhang@suse.com>, <1383643331-6703-2-git-send-email-bjzhang@suse.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: Bamvor Jian Zhang Cc: jfehlig@suse.com, stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Bamvor Jian Zhang writes ("[PATCH 0/2] question on libxl ao"): > there are four choices for using ao_how in libvirt. > (a), ao without callback and set libxl_sigchld_owner_mainloop > (b), ao without callback and set libxl_sigchld_owner_libxl_always > (c), ao with callback and set libxl_sigchld_owner_mainloop > (d), ao with callback and set libxl_sigchld_owner_libxl_always > > i got some trouble when i try (b) and (c). > i still not decided which one is better choice for implement in > libvirt. it would be easier if i could try above four choice. I'm not sure I follow. I think the right answer for libvirt is probably aos specifying callback, and libxl_sigchld_owner_mainloop. I'm assuming that libvirt has something for handling children already. But I haven't looked. If it doesn't then libxl_sigchld_owner_always would probably be best. Bamvor Jian Zhang writes ("[PATCH 1/2] expose child fd in order to handle child exit in libvirt"): > libvirt could handle fd and timeout event through > libxl_osevent_hooks. either of these will not inform the child > exit if libvirt set the libxl_sigchld_owner_libxl_always. I don't exactly follow, but I think you have found a bug. If libvirt specifies libxl_sigchld_owner_libxl_always then libxl will install a SIGCHLD handler and to the self-pipe trick. The self-pipe fd should be registered with the fd event machinery in the normal way. However, this doesn't actually appear to happen. Instead the beforepoll/afterpoll functions handle that fd ad-hoc. The result is that, probably, nothing will notice the selfpipe becoming writable. I will see about writing a patch to fix this. > add a function for returning the sigchld_selfpipe in order to > handle the child exit in libvirt. > meanwhile, there is only one pipe in ctx, it seems that it is > not worth to add this to libxl_osevent_hooks. This approach is not right, though. There is no need to add additional interfaces to libxl. The bug just needs to be fixed. Thanks, Ian.