From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Novotny Subject: Re: [PATCH] Fix bootloader handling when empty string is being output Date: Tue, 31 Aug 2010 12:00:50 +0200 Message-ID: <4C7CD2D2.9010305@redhat.com> References: <4C7BADAA.9080209@redhat.com> <1283244457.12544.9283.camel@zakaz.uk.xensource.com> <4C7CC85A.8070803@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4C7CC85A.8070803@redhat.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Paolo Bonzini Cc: "'xen-devel@lists.xensource.com'" , Ian Campbell List-Id: xen-devel@lists.xenproject.org On 08/31/2010 11:16 AM, Paolo Bonzini wrote: > On 08/31/2010 10:47 AM, Ian Campbell wrote: >> On Mon, 2010-08-30 at 14:10 +0100, Michal Novotny wrote: >>> Hi, >>> this is the patch to fix empty string as the output value >>> of the bootloader string. If there is no output then >>> xend is being hung indefinitely unless you press Ctrl + C keys >>> to trigger SIGINT. >> >> I think a similar fix will be needed to libxl_bootloader.c, right? > > Yes. > >> Could we potentially avoid the need to use a select timeout to poll for >> bootloader exit by including the bootloader FIFO FD and/or the PTY FDs >> in the select's exceptfds array? Presumably if the process on the other >> end of such an FD exits that causes some sort of exceptional condition >> (although historically I've had trouble finding the actual specified >> behaviour in cases like this). > > Using the FIFO is not possible in general because you cannot be sure > that the bootloader is opening it at all. In fact, in this case both > libxl and xend will hang at "fifo_fd = open(fifo, O_RDONLY);" so you > have to apply O_NDELAY already when you open the FIFO. > > Also, in the case the bootloader is not opening the FIFO at all, doing > the waitpid in the same thread has a race if the process exits between > the waitpid and select. Fixing the race requires pselect and, > especially in Python, introduces more complications than it removes. > > So, for RHEL5 xend, Michal has a better version of the patch that will > run the waitpid in a separate thread, and use a pipe to wake up the > select. This does the same thing as /proc, but portably and without > the need for polling. > > However, for both current xend and libxl, using the PTY sounds better, > and it looks like an even simpler patch will work that: > > - uses O_RDONLY|O_NDELAY when opening the FIFO, and > > - exits bootloader_interact when bootloader_fd was in the returned > rsel but ret == 0. > > Paolo So, Paolo, what do you recommend for upstream version? There's the PTY thing already so what should we do ? Ian, also, I don't know how it's working with upstream version since I found out that syntax like `xm create -c PVguest` with default settings (pyGrub bootloader) doesn't show the pyGrub at all so I don't know what's wrong with my setup. I'm using 2.6.32.15-xen kernel/hypervisor version with latest unstable user-space tools. Any hint how this should be working Ian? Thanks, Michal -- Michal Novotny, RHCE Virtualization Team (xen userspace), Red Hat