diff options
Diffstat (limited to 'drivers/xen/xenbus/xenbus_probe.c')
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.c | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index d42e25d5968d..649fcdf114b7 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c | |||
@@ -454,21 +454,21 @@ static ssize_t xendev_show_nodename(struct device *dev, | |||
454 | { | 454 | { |
455 | return sprintf(buf, "%s\n", to_xenbus_device(dev)->nodename); | 455 | return sprintf(buf, "%s\n", to_xenbus_device(dev)->nodename); |
456 | } | 456 | } |
457 | DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL); | 457 | static DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL); |
458 | 458 | ||
459 | static ssize_t xendev_show_devtype(struct device *dev, | 459 | static ssize_t xendev_show_devtype(struct device *dev, |
460 | struct device_attribute *attr, char *buf) | 460 | struct device_attribute *attr, char *buf) |
461 | { | 461 | { |
462 | return sprintf(buf, "%s\n", to_xenbus_device(dev)->devicetype); | 462 | return sprintf(buf, "%s\n", to_xenbus_device(dev)->devicetype); |
463 | } | 463 | } |
464 | DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL); | 464 | static DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL); |
465 | 465 | ||
466 | static ssize_t xendev_show_modalias(struct device *dev, | 466 | static ssize_t xendev_show_modalias(struct device *dev, |
467 | struct device_attribute *attr, char *buf) | 467 | struct device_attribute *attr, char *buf) |
468 | { | 468 | { |
469 | return sprintf(buf, "xen:%s\n", to_xenbus_device(dev)->devicetype); | 469 | return sprintf(buf, "xen:%s\n", to_xenbus_device(dev)->devicetype); |
470 | } | 470 | } |
471 | DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL); | 471 | static DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL); |
472 | 472 | ||
473 | int xenbus_probe_node(struct xen_bus_type *bus, | 473 | int xenbus_probe_node(struct xen_bus_type *bus, |
474 | const char *type, | 474 | const char *type, |
@@ -843,7 +843,7 @@ postcore_initcall(xenbus_probe_init); | |||
843 | 843 | ||
844 | MODULE_LICENSE("GPL"); | 844 | MODULE_LICENSE("GPL"); |
845 | 845 | ||
846 | static int is_disconnected_device(struct device *dev, void *data) | 846 | static int is_device_connecting(struct device *dev, void *data) |
847 | { | 847 | { |
848 | struct xenbus_device *xendev = to_xenbus_device(dev); | 848 | struct xenbus_device *xendev = to_xenbus_device(dev); |
849 | struct device_driver *drv = data; | 849 | struct device_driver *drv = data; |
@@ -861,14 +861,15 @@ static int is_disconnected_device(struct device *dev, void *data) | |||
861 | return 0; | 861 | return 0; |
862 | 862 | ||
863 | xendrv = to_xenbus_driver(dev->driver); | 863 | xendrv = to_xenbus_driver(dev->driver); |
864 | return (xendev->state != XenbusStateConnected || | 864 | return (xendev->state < XenbusStateConnected || |
865 | (xendrv->is_ready && !xendrv->is_ready(xendev))); | 865 | (xendev->state == XenbusStateConnected && |
866 | xendrv->is_ready && !xendrv->is_ready(xendev))); | ||
866 | } | 867 | } |
867 | 868 | ||
868 | static int exists_disconnected_device(struct device_driver *drv) | 869 | static int exists_connecting_device(struct device_driver *drv) |
869 | { | 870 | { |
870 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, | 871 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, |
871 | is_disconnected_device); | 872 | is_device_connecting); |
872 | } | 873 | } |
873 | 874 | ||
874 | static int print_device_status(struct device *dev, void *data) | 875 | static int print_device_status(struct device *dev, void *data) |
@@ -884,10 +885,13 @@ static int print_device_status(struct device *dev, void *data) | |||
884 | /* Information only: is this too noisy? */ | 885 | /* Information only: is this too noisy? */ |
885 | printk(KERN_INFO "XENBUS: Device with no driver: %s\n", | 886 | printk(KERN_INFO "XENBUS: Device with no driver: %s\n", |
886 | xendev->nodename); | 887 | xendev->nodename); |
887 | } else if (xendev->state != XenbusStateConnected) { | 888 | } else if (xendev->state < XenbusStateConnected) { |
889 | enum xenbus_state rstate = XenbusStateUnknown; | ||
890 | if (xendev->otherend) | ||
891 | rstate = xenbus_read_driver_state(xendev->otherend); | ||
888 | printk(KERN_WARNING "XENBUS: Timeout connecting " | 892 | printk(KERN_WARNING "XENBUS: Timeout connecting " |
889 | "to device: %s (state %d)\n", | 893 | "to device: %s (local state %d, remote state %d)\n", |
890 | xendev->nodename, xendev->state); | 894 | xendev->nodename, xendev->state, rstate); |
891 | } | 895 | } |
892 | 896 | ||
893 | return 0; | 897 | return 0; |
@@ -897,7 +901,7 @@ static int print_device_status(struct device *dev, void *data) | |||
897 | static int ready_to_wait_for_devices; | 901 | static int ready_to_wait_for_devices; |
898 | 902 | ||
899 | /* | 903 | /* |
900 | * On a 10 second timeout, wait for all devices currently configured. We need | 904 | * 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 | 905 | * 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. | 906 | * needed for boot are available, before we can allow the boot to proceed. |
903 | * | 907 | * |
@@ -912,18 +916,30 @@ static int ready_to_wait_for_devices; | |||
912 | */ | 916 | */ |
913 | static void wait_for_devices(struct xenbus_driver *xendrv) | 917 | static void wait_for_devices(struct xenbus_driver *xendrv) |
914 | { | 918 | { |
915 | unsigned long timeout = jiffies + 10*HZ; | 919 | unsigned long start = jiffies; |
916 | struct device_driver *drv = xendrv ? &xendrv->driver : NULL; | 920 | struct device_driver *drv = xendrv ? &xendrv->driver : NULL; |
921 | unsigned int seconds_waited = 0; | ||
917 | 922 | ||
918 | if (!ready_to_wait_for_devices || !xen_domain()) | 923 | if (!ready_to_wait_for_devices || !xen_domain()) |
919 | return; | 924 | return; |
920 | 925 | ||
921 | while (exists_disconnected_device(drv)) { | 926 | while (exists_connecting_device(drv)) { |
922 | if (time_after(jiffies, timeout)) | 927 | if (time_after(jiffies, start + (seconds_waited+5)*HZ)) { |
923 | break; | 928 | if (!seconds_waited) |
929 | printk(KERN_WARNING "XENBUS: Waiting for " | ||
930 | "devices to initialise: "); | ||
931 | seconds_waited += 5; | ||
932 | printk("%us...", 300 - seconds_waited); | ||
933 | if (seconds_waited == 300) | ||
934 | break; | ||
935 | } | ||
936 | |||
924 | schedule_timeout_interruptible(HZ/10); | 937 | schedule_timeout_interruptible(HZ/10); |
925 | } | 938 | } |
926 | 939 | ||
940 | if (seconds_waited) | ||
941 | printk("\n"); | ||
942 | |||
927 | bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, | 943 | bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, |
928 | print_device_status); | 944 | print_device_status); |
929 | } | 945 | } |