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: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] Fix bootloader handling when empty string is being output
From: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Date: Tue, 31 Aug 2010 11:16:10 +0200
Cc: Michal Novotny <minovotn@xxxxxxxxxx>, "'xen-devel@xxxxxxxxxxxxxxxxxxx'" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 31 Aug 2010 02:17:12 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=Bt8iRNBT5QM+hDpHr31XgY+rVWW5YTAlHkLDiGM1dYk=; b=E07MFhrBsVtwtqWggDYc4QD/5BB0nyH1eBIdsJDtYZuUTihA0X1Oq0FEW17y8Khjf5 +3SaheD7fEdf+x7BieqmVkhnhy8QLcxCTBYtoArW3cUlD1a7wGiyJSjJzP6kJihy/tAX PmIp2b3tRPvKsg5E97kB+Y8q6ugXAjCbqCJwE=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=OaWwW+f2YH/cwyRJcER0VrYGg1+71AKBTe2v3fADEKL6h9aCdPCOki6finlrRY/vtP 1XJ4d4shzvjodn89SX3xtjq+HkzV5tRlr2ZKimKzwIO6eX1vg9RjMgie5IkPhYJcaHAI giax2AQF3kuJhYNeHRs60p1VueQMStMO58LAM=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1283244457.12544.9283.camel@xxxxxxxxxxxxxxxxxxxxxx>
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5
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.


Xen-devel mailing list