This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] Re: [PATCH] Fix bootloader handling when empty string is bei

To: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] Fix bootloader handling when empty string is being output
From: Michal Novotny <minovotn@xxxxxxxxxx>
Date: Tue, 31 Aug 2010 12:00:50 +0200
Cc: "'xen-devel@xxxxxxxxxxxxxxxxxxx'" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Delivery-date: Tue, 31 Aug 2010 03:02:03 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4C7CC85A.8070803@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4C7BADAA.9080209@xxxxxxxxxx> <1283244457.12544.9283.camel@xxxxxxxxxxxxxxxxxxxxxx> <4C7CC85A.8070803@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20100430 Fedora/3.0.4-3.fc13 Thunderbird/3.0.4
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:
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?


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.

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 kernel/hypervisor version with latest unstable user-space tools.

Any hint how this should be working Ian?


Michal Novotny<minovotn@xxxxxxxxxx>, RHCE
Virtualization Team (xen userspace), Red Hat

Xen-devel mailing list