From: Mark McLoughlin Subject: Re: [PATCH] Improve xenbus timeout error message Date: Fri, 30 Jun 2006 17:52:20 +0100 Message-ID: <1151686340.6184.62.camel@localhost.localdomain> References: <1151681386.6184.60.camel@localhost.localdomain> <20060630154433.GG8835@leeni.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-fRPefoBb2xbRsx7MwMVt" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com, Ewan Mellor List-Id: xen-devel@lists.xenproject.org --=-fRPefoBb2xbRsx7MwMVt Content-Type: text/plain Content-Transfer-Encoding: 7bit On Fri, 2006-06-30 at 16:58 +0100, Keir Fraser wrote: > On 30 Jun 2006, at 16:44, Ewan Mellor wrote: > > >> The problem is that the timeout occurs before the xennet module can > >> ever be loaded, which is to be expected. Anything that can be done to > >> avoid the timeout in this case? > > > > The timeout is there to ensure that the boot does not proceed until > > all the > > devices needed during boot are available. In this case, since it's a > > vif, if > > you were using an NFS root then your boot would presumably fail. > > > > If you need to improve this, you will have to have some way to tell > > the tools > > "these devices I need for boot, these I don't", and then have the > > tools put a > > flag in the store so that Xenbus knows that it doesn't need to wait > > for them. > > The obvious thing to do here is work out which devices haven't been > picked up by any driver, and not wait on those since they are obviously > not going to connect! We should either silently ignore those, or maybe > print a list of them for information. Good point, how about this patch then? Cheers, Mark. --=-fRPefoBb2xbRsx7MwMVt Content-Disposition: attachment; filename=linux-2.6.16-xenbus-timeout-message.patch Content-Type: text/x-patch; name=linux-2.6.16-xenbus-timeout-message.patch; charset=utf-8 Content-Transfer-Encoding: 7bit --- ./linux-2.6.16.x86_64/drivers/xen/xenbus/xenbus_probe.c.timeout-message 2006-06-27 20:50:43.000000000 +0100 +++ ./linux-2.6.16.x86_64/drivers/xen/xenbus/xenbus_probe.c 2006-06-30 18:48:02.000000000 +0100 @@ -879,29 +879,19 @@ EXPORT_SYMBOL_GPL(unregister_xenstore_notifier); -static int all_devices_ready_(struct device *dev, void *data) +static int find_disconnected_device_(struct device *dev, void *data) { struct xenbus_device *xendev = to_xenbus_device(dev); - int *result = data; - if (xendev->state != XenbusStateConnected) { - *result = 0; - return 1; - } - - return 0; + return (dev->driver == NULL || xendev->state == XenbusStateConnected) ? 0 : 1; } - -static int all_devices_ready(void) +static struct device *find_disconnected_device(struct device *start) { - int ready = 1; - bus_for_each_dev(&xenbus_frontend.bus, NULL, &ready, - all_devices_ready_); - return ready; + return bus_find_device(&xenbus_frontend.bus, start, NULL, + find_disconnected_device_); } - void xenbus_probe(void *unused) { BUG_ON((xenstored_ready <= 0)); @@ -1066,17 +1056,30 @@ static int __init wait_for_devices(void) { unsigned long timeout = jiffies + 10*HZ; + struct device *dev = NULL; + struct xenbus_device *xendev; if (!is_running_on_xen()) return -ENODEV; while (time_before(jiffies, timeout)) { - if (all_devices_ready()) + if ((dev = find_disconnected_device(NULL)) == NULL) return 0; + put_device(dev); schedule_timeout_interruptible(HZ/10); } - printk(KERN_WARNING "XENBUS: Timeout connecting to devices!\n"); + dev = NULL; + + while ((dev = find_disconnected_device(dev)) != NULL) { + xendev = to_xenbus_device(dev); + + printk(KERN_WARNING "XENBUS: Timeout connecting to device: %s\n", + xendev->nodename); + + put_device(dev); + } + return 0; } --=-fRPefoBb2xbRsx7MwMVt Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-fRPefoBb2xbRsx7MwMVt--