aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/xenbus
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/xen/xenbus
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/xen/xenbus')
-rw-r--r--drivers/xen/xenbus/xenbus_client.c1
-rw-r--r--drivers/xen/xenbus/xenbus_probe.c51
2 files changed, 36 insertions, 16 deletions
diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
index 92a1ef80a288..7b3e973a1aee 100644
--- a/drivers/xen/xenbus/xenbus_client.c
+++ b/drivers/xen/xenbus/xenbus_client.c
@@ -30,6 +30,7 @@
30 * IN THE SOFTWARE. 30 * IN THE SOFTWARE.
31 */ 31 */
32 32
33#include <linux/slab.h>
33#include <linux/types.h> 34#include <linux/types.h>
34#include <linux/vmalloc.h> 35#include <linux/vmalloc.h>
35#include <asm/xen/hypervisor.h> 36#include <asm/xen/hypervisor.h>
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index d42e25d5968d..3479332113e9 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -45,10 +45,13 @@
45#include <linux/kthread.h> 45#include <linux/kthread.h>
46#include <linux/mutex.h> 46#include <linux/mutex.h>
47#include <linux/io.h> 47#include <linux/io.h>
48#include <linux/slab.h>
48 49
49#include <asm/page.h> 50#include <asm/page.h>
50#include <asm/pgtable.h> 51#include <asm/pgtable.h>
51#include <asm/xen/hypervisor.h> 52#include <asm/xen/hypervisor.h>
53
54#include <xen/xen.h>
52#include <xen/xenbus.h> 55#include <xen/xenbus.h>
53#include <xen/events.h> 56#include <xen/events.h>
54#include <xen/page.h> 57#include <xen/page.h>
@@ -454,21 +457,21 @@ static ssize_t xendev_show_nodename(struct device *dev,
454{ 457{
455 return sprintf(buf, "%s\n", to_xenbus_device(dev)->nodename); 458 return sprintf(buf, "%s\n", to_xenbus_device(dev)->nodename);
456} 459}
457DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL); 460static DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL);
458 461
459static ssize_t xendev_show_devtype(struct device *dev, 462static ssize_t xendev_show_devtype(struct device *dev,
460 struct device_attribute *attr, char *buf) 463 struct device_attribute *attr, char *buf)
461{ 464{
462 return sprintf(buf, "%s\n", to_xenbus_device(dev)->devicetype); 465 return sprintf(buf, "%s\n", to_xenbus_device(dev)->devicetype);
463} 466}
464DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL); 467static DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL);
465 468
466static ssize_t xendev_show_modalias(struct device *dev, 469static ssize_t xendev_show_modalias(struct device *dev,
467 struct device_attribute *attr, char *buf) 470 struct device_attribute *attr, char *buf)
468{ 471{
469 return sprintf(buf, "xen:%s\n", to_xenbus_device(dev)->devicetype); 472 return sprintf(buf, "xen:%s\n", to_xenbus_device(dev)->devicetype);
470} 473}
471DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL); 474static DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL);
472 475
473int xenbus_probe_node(struct xen_bus_type *bus, 476int xenbus_probe_node(struct xen_bus_type *bus,
474 const char *type, 477 const char *type,
@@ -843,7 +846,7 @@ postcore_initcall(xenbus_probe_init);
843 846
844MODULE_LICENSE("GPL"); 847MODULE_LICENSE("GPL");
845 848
846static int is_disconnected_device(struct device *dev, void *data) 849static int is_device_connecting(struct device *dev, void *data)
847{ 850{
848 struct xenbus_device *xendev = to_xenbus_device(dev); 851 struct xenbus_device *xendev = to_xenbus_device(dev);
849 struct device_driver *drv = data; 852 struct device_driver *drv = data;
@@ -861,14 +864,15 @@ static int is_disconnected_device(struct device *dev, void *data)
861 return 0; 864 return 0;
862 865
863 xendrv = to_xenbus_driver(dev->driver); 866 xendrv = to_xenbus_driver(dev->driver);
864 return (xendev->state != XenbusStateConnected || 867 return (xendev->state < XenbusStateConnected ||
865 (xendrv->is_ready && !xendrv->is_ready(xendev))); 868 (xendev->state == XenbusStateConnected &&
869 xendrv->is_ready && !xendrv->is_ready(xendev)));
866} 870}
867 871
868static int exists_disconnected_device(struct device_driver *drv) 872static int exists_connecting_device(struct device_driver *drv)
869{ 873{
870 return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, 874 return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv,
871 is_disconnected_device); 875 is_device_connecting);
872} 876}
873 877
874static int print_device_status(struct device *dev, void *data) 878static int print_device_status(struct device *dev, void *data)
@@ -884,10 +888,13 @@ static int print_device_status(struct device *dev, void *data)
884 /* Information only: is this too noisy? */ 888 /* Information only: is this too noisy? */
885 printk(KERN_INFO "XENBUS: Device with no driver: %s\n", 889 printk(KERN_INFO "XENBUS: Device with no driver: %s\n",
886 xendev->nodename); 890 xendev->nodename);
887 } else if (xendev->state != XenbusStateConnected) { 891 } else if (xendev->state < XenbusStateConnected) {
892 enum xenbus_state rstate = XenbusStateUnknown;
893 if (xendev->otherend)
894 rstate = xenbus_read_driver_state(xendev->otherend);
888 printk(KERN_WARNING "XENBUS: Timeout connecting " 895 printk(KERN_WARNING "XENBUS: Timeout connecting "
889 "to device: %s (state %d)\n", 896 "to device: %s (local state %d, remote state %d)\n",
890 xendev->nodename, xendev->state); 897 xendev->nodename, xendev->state, rstate);
891 } 898 }
892 899
893 return 0; 900 return 0;
@@ -897,7 +904,7 @@ static int print_device_status(struct device *dev, void *data)
897static int ready_to_wait_for_devices; 904static int ready_to_wait_for_devices;
898 905
899/* 906/*
900 * On a 10 second timeout, wait for all devices currently configured. We need 907 * On a 5-minute timeout, wait for all devices currently configured. We need
901 * to do this to guarantee that the filesystems and / or network devices 908 * to do this to guarantee that the filesystems and / or network devices
902 * needed for boot are available, before we can allow the boot to proceed. 909 * needed for boot are available, before we can allow the boot to proceed.
903 * 910 *
@@ -912,18 +919,30 @@ static int ready_to_wait_for_devices;
912 */ 919 */
913static void wait_for_devices(struct xenbus_driver *xendrv) 920static void wait_for_devices(struct xenbus_driver *xendrv)
914{ 921{
915 unsigned long timeout = jiffies + 10*HZ; 922 unsigned long start = jiffies;
916 struct device_driver *drv = xendrv ? &xendrv->driver : NULL; 923 struct device_driver *drv = xendrv ? &xendrv->driver : NULL;
924 unsigned int seconds_waited = 0;
917 925
918 if (!ready_to_wait_for_devices || !xen_domain()) 926 if (!ready_to_wait_for_devices || !xen_domain())
919 return; 927 return;
920 928
921 while (exists_disconnected_device(drv)) { 929 while (exists_connecting_device(drv)) {
922 if (time_after(jiffies, timeout)) 930 if (time_after(jiffies, start + (seconds_waited+5)*HZ)) {
923 break; 931 if (!seconds_waited)
932 printk(KERN_WARNING "XENBUS: Waiting for "
933 "devices to initialise: ");
934 seconds_waited += 5;
935 printk("%us...", 300 - seconds_waited);
936 if (seconds_waited == 300)
937 break;
938 }
939
924 schedule_timeout_interruptible(HZ/10); 940 schedule_timeout_interruptible(HZ/10);
925 } 941 }
926 942
943 if (seconds_waited)
944 printk("\n");
945
927 bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, 946 bus_for_each_dev(&xenbus_frontend.bus, NULL, drv,
928 print_device_status); 947 print_device_status);
929} 948}