On 08/31/2010 11:16 AM, Paolo Bonzini wrote:
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 18.104.22.168-xen kernel/hypervisor version with latest unstable
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.
Any hint how this should be working Ian?
Michal Novotny<minovotn@xxxxxxxxxx>, RHCE
Virtualization Team (xen userspace), Red Hat
Xen-devel mailing list