From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: Re: [libvirt] [PATCH 00/12] libxl: fork: SIGCHLD flexibility Date: Wed, 29 Jan 2014 16:23:08 +0000 Message-ID: <21225.10988.728464.567330@mariner.uk.xensource.com> References: <1389975845-1195-1-git-send-email-ian.jackson@eu.citrix.com> <52D9AECF.6050309@suse.com> <52DD678F.3070504@suse.com> <21214.37402.648941.864060@mariner.uk.xensource.com> <52DF57E2.2090602@suse.com> <52E09513.6060603@suse.com> <21216.62800.746512.422459@mariner.uk.xensource.com> <52E1EB97.4080007@suse.com> <21218.24466.92095.134875@mariner.uk.xensource.com> <52E70A58.2060002@suse.com> <20140128100608.GE19598@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20140128100608.GE19598@redhat.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: "Daniel P. Berrange" Cc: LibVir , Jim Fehlig , xen-devel@lists.xensource.com, Ian Campbell List-Id: xen-devel@lists.xenproject.org Daniel P. Berrange writes ("Re: [libvirt] [Xen-devel] [PATCH 00/12] libxl: fork: SIGCHLD flexibility"): > Yes, you are correct. The threading model for libvirtd is that the > process thread leader executes the event loop, dealing with timer > and file descriptor I/O callbacks. There are also 'n' worker threads > which exclusively handle public API calls from libvirt clients. IOW > all your timer callbacks will be in one thread - which also means > you want your timer callbacks to be fast to execute. Right. Good. All of libxl's callbacks should be fast. There is still the problem that libxl functions on other threads may make an fd deregistration call, while libvirt's event loop is still polling (or selecting) on the fd in the main loop. libxl might then close the fd, dup2 something onto it, leave the fd to be reused for some other object. Depending on the underlying kernel, that can cause side effects. I have reproduced the analogous bug with libxl's event loop, but I had to use an fd connected to the controlling tty, from a background process group, when the tty has stty tostop. polling such a thing for POLLOUT raises SIGTTOU. Of course the libvirt xl driver still needs to cope with being told by libxl to register or modify a timeout, or register deregister or modify an fd, in other than the master thread. Ian.