diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/xen/xenbus | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (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.c | 1 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.c | 51 |
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 | } |
457 | DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL); | 460 | static DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL); |
458 | 461 | ||
459 | static ssize_t xendev_show_devtype(struct device *dev, | 462 | static 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 | } |
464 | DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL); | 467 | static DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL); |
465 | 468 | ||
466 | static ssize_t xendev_show_modalias(struct device *dev, | 469 | static 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 | } |
471 | DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL); | 474 | static DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL); |
472 | 475 | ||
473 | int xenbus_probe_node(struct xen_bus_type *bus, | 476 | int 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 | ||
844 | MODULE_LICENSE("GPL"); | 847 | MODULE_LICENSE("GPL"); |
845 | 848 | ||
846 | static int is_disconnected_device(struct device *dev, void *data) | 849 | static 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 | ||
868 | static int exists_disconnected_device(struct device_driver *drv) | 872 | static 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 | ||
874 | static int print_device_status(struct device *dev, void *data) | 878 | static 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) | |||
897 | static int ready_to_wait_for_devices; | 904 | static 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 | */ |
913 | static void wait_for_devices(struct xenbus_driver *xendrv) | 920 | static 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 | } |