diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-20 14:31:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-20 14:31:00 -0400 |
commit | c1acb0ba330b3bcf4b110c4ae538f4f80b991fda (patch) | |
tree | dd7d0de2f682b0e88c8636d1817f8f293cc76f5f | |
parent | 19244ad06b70ed84931df868583547ce1cd3a186 (diff) | |
parent | 3d81acb1cdb242378a1acb3eb1bc28c6bb5895f1 (diff) |
Merge tag 'stable/for-linus-3.4-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
Pull xen fixes from Konrad Rzeszutek Wilk:
- mechanism to work with misconfigured backends (where they are
advertised but in reality don't exist).
- two tiny compile warning fixes.
- proper error handling in gnttab_resume
- Not using VM_PFNMAP anymore to allow backends in the same domain.
* tag 'stable/for-linus-3.4-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
Revert "xen/p2m: m2p_find_override: use list_for_each_entry_safe"
xen/resume: Fix compile warnings.
xen/xenbus: Add quirk to deal with misconfigured backends.
xen/blkback: Fix warning error.
xen/p2m: m2p_find_override: use list_for_each_entry_safe
xen/gntdev: do not set VM_PFNMAP
xen/grant-table: add error-handling code on failure of gnttab_resume
-rw-r--r-- | drivers/block/xen-blkback/xenbus.c | 2 | ||||
-rw-r--r-- | drivers/xen/gntdev.c | 2 | ||||
-rw-r--r-- | drivers/xen/grant-table.c | 13 | ||||
-rw-r--r-- | drivers/xen/manage.c | 1 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe_frontend.c | 69 |
5 files changed, 65 insertions, 22 deletions
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 89860f34a7ec..4f66171c6683 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -416,7 +416,7 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info | |||
416 | "discard-secure", "%d", | 416 | "discard-secure", "%d", |
417 | blkif->vbd.discard_secure); | 417 | blkif->vbd.discard_secure); |
418 | if (err) { | 418 | if (err) { |
419 | dev_warn(dev-dev, "writing discard-secure (%d)", err); | 419 | dev_warn(&dev->dev, "writing discard-secure (%d)", err); |
420 | return; | 420 | return; |
421 | } | 421 | } |
422 | } | 422 | } |
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 99d8151c824a..1ffd03bf8e10 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
@@ -722,7 +722,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) | |||
722 | vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND; | 722 | vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND; |
723 | 723 | ||
724 | if (use_ptemod) | 724 | if (use_ptemod) |
725 | vma->vm_flags |= VM_DONTCOPY|VM_PFNMAP; | 725 | vma->vm_flags |= VM_DONTCOPY; |
726 | 726 | ||
727 | vma->vm_private_data = map; | 727 | vma->vm_private_data = map; |
728 | 728 | ||
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index b4d4eac761db..f100ce20b16b 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -1029,6 +1029,7 @@ int gnttab_init(void) | |||
1029 | int i; | 1029 | int i; |
1030 | unsigned int max_nr_glist_frames, nr_glist_frames; | 1030 | unsigned int max_nr_glist_frames, nr_glist_frames; |
1031 | unsigned int nr_init_grefs; | 1031 | unsigned int nr_init_grefs; |
1032 | int ret; | ||
1032 | 1033 | ||
1033 | nr_grant_frames = 1; | 1034 | nr_grant_frames = 1; |
1034 | boot_max_nr_grant_frames = __max_nr_grant_frames(); | 1035 | boot_max_nr_grant_frames = __max_nr_grant_frames(); |
@@ -1047,12 +1048,16 @@ int gnttab_init(void) | |||
1047 | nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; | 1048 | nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; |
1048 | for (i = 0; i < nr_glist_frames; i++) { | 1049 | for (i = 0; i < nr_glist_frames; i++) { |
1049 | gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); | 1050 | gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); |
1050 | if (gnttab_list[i] == NULL) | 1051 | if (gnttab_list[i] == NULL) { |
1052 | ret = -ENOMEM; | ||
1051 | goto ini_nomem; | 1053 | goto ini_nomem; |
1054 | } | ||
1052 | } | 1055 | } |
1053 | 1056 | ||
1054 | if (gnttab_resume() < 0) | 1057 | if (gnttab_resume() < 0) { |
1055 | return -ENODEV; | 1058 | ret = -ENODEV; |
1059 | goto ini_nomem; | ||
1060 | } | ||
1056 | 1061 | ||
1057 | nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; | 1062 | nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; |
1058 | 1063 | ||
@@ -1070,7 +1075,7 @@ int gnttab_init(void) | |||
1070 | for (i--; i >= 0; i--) | 1075 | for (i--; i >= 0; i--) |
1071 | free_page((unsigned long)gnttab_list[i]); | 1076 | free_page((unsigned long)gnttab_list[i]); |
1072 | kfree(gnttab_list); | 1077 | kfree(gnttab_list); |
1073 | return -ENOMEM; | 1078 | return ret; |
1074 | } | 1079 | } |
1075 | EXPORT_SYMBOL_GPL(gnttab_init); | 1080 | EXPORT_SYMBOL_GPL(gnttab_init); |
1076 | 1081 | ||
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 9e14ae6cd49c..412b96cc5305 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -132,6 +132,7 @@ static void do_suspend(void) | |||
132 | err = dpm_suspend_end(PMSG_FREEZE); | 132 | err = dpm_suspend_end(PMSG_FREEZE); |
133 | if (err) { | 133 | if (err) { |
134 | printk(KERN_ERR "dpm_suspend_end failed: %d\n", err); | 134 | printk(KERN_ERR "dpm_suspend_end failed: %d\n", err); |
135 | si.cancelled = 0; | ||
135 | goto out_resume; | 136 | goto out_resume; |
136 | } | 137 | } |
137 | 138 | ||
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index f20c5f178b40..a31b54d48839 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c | |||
@@ -135,7 +135,7 @@ static int read_backend_details(struct xenbus_device *xendev) | |||
135 | return xenbus_read_otherend_details(xendev, "backend-id", "backend"); | 135 | return xenbus_read_otherend_details(xendev, "backend-id", "backend"); |
136 | } | 136 | } |
137 | 137 | ||
138 | static int is_device_connecting(struct device *dev, void *data) | 138 | static int is_device_connecting(struct device *dev, void *data, bool ignore_nonessential) |
139 | { | 139 | { |
140 | struct xenbus_device *xendev = to_xenbus_device(dev); | 140 | struct xenbus_device *xendev = to_xenbus_device(dev); |
141 | struct device_driver *drv = data; | 141 | struct device_driver *drv = data; |
@@ -152,16 +152,41 @@ static int is_device_connecting(struct device *dev, void *data) | |||
152 | if (drv && (dev->driver != drv)) | 152 | if (drv && (dev->driver != drv)) |
153 | return 0; | 153 | return 0; |
154 | 154 | ||
155 | if (ignore_nonessential) { | ||
156 | /* With older QEMU, for PVonHVM guests the guest config files | ||
157 | * could contain: vfb = [ 'vnc=1, vnclisten=0.0.0.0'] | ||
158 | * which is nonsensical as there is no PV FB (there can be | ||
159 | * a PVKB) running as HVM guest. */ | ||
160 | |||
161 | if ((strncmp(xendev->nodename, "device/vkbd", 11) == 0)) | ||
162 | return 0; | ||
163 | |||
164 | if ((strncmp(xendev->nodename, "device/vfb", 10) == 0)) | ||
165 | return 0; | ||
166 | } | ||
155 | xendrv = to_xenbus_driver(dev->driver); | 167 | xendrv = to_xenbus_driver(dev->driver); |
156 | return (xendev->state < XenbusStateConnected || | 168 | return (xendev->state < XenbusStateConnected || |
157 | (xendev->state == XenbusStateConnected && | 169 | (xendev->state == XenbusStateConnected && |
158 | xendrv->is_ready && !xendrv->is_ready(xendev))); | 170 | xendrv->is_ready && !xendrv->is_ready(xendev))); |
159 | } | 171 | } |
172 | static int essential_device_connecting(struct device *dev, void *data) | ||
173 | { | ||
174 | return is_device_connecting(dev, data, true /* ignore PV[KBB+FB] */); | ||
175 | } | ||
176 | static int non_essential_device_connecting(struct device *dev, void *data) | ||
177 | { | ||
178 | return is_device_connecting(dev, data, false); | ||
179 | } | ||
160 | 180 | ||
161 | static int exists_connecting_device(struct device_driver *drv) | 181 | static int exists_essential_connecting_device(struct device_driver *drv) |
162 | { | 182 | { |
163 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, | 183 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, |
164 | is_device_connecting); | 184 | essential_device_connecting); |
185 | } | ||
186 | static int exists_non_essential_connecting_device(struct device_driver *drv) | ||
187 | { | ||
188 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, | ||
189 | non_essential_device_connecting); | ||
165 | } | 190 | } |
166 | 191 | ||
167 | static int print_device_status(struct device *dev, void *data) | 192 | static int print_device_status(struct device *dev, void *data) |
@@ -192,6 +217,23 @@ static int print_device_status(struct device *dev, void *data) | |||
192 | /* We only wait for device setup after most initcalls have run. */ | 217 | /* We only wait for device setup after most initcalls have run. */ |
193 | static int ready_to_wait_for_devices; | 218 | static int ready_to_wait_for_devices; |
194 | 219 | ||
220 | static bool wait_loop(unsigned long start, unsigned int max_delay, | ||
221 | unsigned int *seconds_waited) | ||
222 | { | ||
223 | if (time_after(jiffies, start + (*seconds_waited+5)*HZ)) { | ||
224 | if (!*seconds_waited) | ||
225 | printk(KERN_WARNING "XENBUS: Waiting for " | ||
226 | "devices to initialise: "); | ||
227 | *seconds_waited += 5; | ||
228 | printk("%us...", max_delay - *seconds_waited); | ||
229 | if (*seconds_waited == max_delay) | ||
230 | return true; | ||
231 | } | ||
232 | |||
233 | schedule_timeout_interruptible(HZ/10); | ||
234 | |||
235 | return false; | ||
236 | } | ||
195 | /* | 237 | /* |
196 | * On a 5-minute timeout, wait for all devices currently configured. We need | 238 | * On a 5-minute timeout, wait for all devices currently configured. We need |
197 | * to do this to guarantee that the filesystems and / or network devices | 239 | * to do this to guarantee that the filesystems and / or network devices |
@@ -215,19 +257,14 @@ static void wait_for_devices(struct xenbus_driver *xendrv) | |||
215 | if (!ready_to_wait_for_devices || !xen_domain()) | 257 | if (!ready_to_wait_for_devices || !xen_domain()) |
216 | return; | 258 | return; |
217 | 259 | ||
218 | while (exists_connecting_device(drv)) { | 260 | while (exists_non_essential_connecting_device(drv)) |
219 | if (time_after(jiffies, start + (seconds_waited+5)*HZ)) { | 261 | if (wait_loop(start, 30, &seconds_waited)) |
220 | if (!seconds_waited) | 262 | break; |
221 | printk(KERN_WARNING "XENBUS: Waiting for " | 263 | |
222 | "devices to initialise: "); | 264 | /* Skips PVKB and PVFB check.*/ |
223 | seconds_waited += 5; | 265 | while (exists_essential_connecting_device(drv)) |
224 | printk("%us...", 300 - seconds_waited); | 266 | if (wait_loop(start, 270, &seconds_waited)) |
225 | if (seconds_waited == 300) | 267 | break; |
226 | break; | ||
227 | } | ||
228 | |||
229 | schedule_timeout_interruptible(HZ/10); | ||
230 | } | ||
231 | 268 | ||
232 | if (seconds_waited) | 269 | if (seconds_waited) |
233 | printk("\n"); | 270 | printk("\n"); |