diff options
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/Kconfig | 12 | ||||
-rw-r--r-- | drivers/xen/balloon.c | 41 | ||||
-rw-r--r-- | drivers/xen/cpu_hotplug.c | 3 | ||||
-rw-r--r-- | drivers/xen/events.c | 12 | ||||
-rw-r--r-- | drivers/xen/evtchn.c | 3 | ||||
-rw-r--r-- | drivers/xen/grant-table.c | 2 | ||||
-rw-r--r-- | drivers/xen/manage.c | 32 | ||||
-rw-r--r-- | drivers/xen/sys-hypervisor.c | 4 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_client.c | 1 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.c | 51 | ||||
-rw-r--r-- | drivers/xen/xencomm.c | 2 | ||||
-rw-r--r-- | drivers/xen/xenfs/super.c | 2 | ||||
-rw-r--r-- | drivers/xen/xenfs/xenbus.c | 1 |
13 files changed, 100 insertions, 66 deletions
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index cab100acf983..fad3df2c1276 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
@@ -1,6 +1,8 @@ | |||
1 | menu "Xen driver support" | ||
2 | depends on XEN | ||
3 | |||
1 | config XEN_BALLOON | 4 | config XEN_BALLOON |
2 | bool "Xen memory balloon driver" | 5 | bool "Xen memory balloon driver" |
3 | depends on XEN | ||
4 | default y | 6 | default y |
5 | help | 7 | help |
6 | The balloon driver allows the Xen domain to request more memory from | 8 | The balloon driver allows the Xen domain to request more memory from |
@@ -20,7 +22,6 @@ config XEN_SCRUB_PAGES | |||
20 | 22 | ||
21 | config XEN_DEV_EVTCHN | 23 | config XEN_DEV_EVTCHN |
22 | tristate "Xen /dev/xen/evtchn device" | 24 | tristate "Xen /dev/xen/evtchn device" |
23 | depends on XEN | ||
24 | default y | 25 | default y |
25 | help | 26 | help |
26 | The evtchn driver allows a userspace process to triger event | 27 | The evtchn driver allows a userspace process to triger event |
@@ -30,7 +31,6 @@ config XEN_DEV_EVTCHN | |||
30 | 31 | ||
31 | config XENFS | 32 | config XENFS |
32 | tristate "Xen filesystem" | 33 | tristate "Xen filesystem" |
33 | depends on XEN | ||
34 | default y | 34 | default y |
35 | help | 35 | help |
36 | The xen filesystem provides a way for domains to share | 36 | The xen filesystem provides a way for domains to share |
@@ -53,11 +53,13 @@ config XEN_COMPAT_XENFS | |||
53 | 53 | ||
54 | config XEN_SYS_HYPERVISOR | 54 | config XEN_SYS_HYPERVISOR |
55 | bool "Create xen entries under /sys/hypervisor" | 55 | bool "Create xen entries under /sys/hypervisor" |
56 | depends on XEN && SYSFS | 56 | depends on SYSFS |
57 | select SYS_HYPERVISOR | 57 | select SYS_HYPERVISOR |
58 | default y | 58 | default y |
59 | help | 59 | help |
60 | Create entries under /sys/hypervisor describing the Xen | 60 | Create entries under /sys/hypervisor describing the Xen |
61 | hypervisor environment. When running native or in another | 61 | hypervisor environment. When running native or in another |
62 | virtual environment, /sys/hypervisor will still be present, | 62 | virtual environment, /sys/hypervisor will still be present, |
63 | but will have no xen contents. \ No newline at end of file | 63 | but will have no xen contents. |
64 | |||
65 | endmenu | ||
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index d31505b6f7a4..1a0d8c2a0354 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/mutex.h> | 43 | #include <linux/mutex.h> |
44 | #include <linux/list.h> | 44 | #include <linux/list.h> |
45 | #include <linux/sysdev.h> | 45 | #include <linux/sysdev.h> |
46 | #include <linux/gfp.h> | ||
46 | 47 | ||
47 | #include <asm/page.h> | 48 | #include <asm/page.h> |
48 | #include <asm/pgalloc.h> | 49 | #include <asm/pgalloc.h> |
@@ -52,6 +53,8 @@ | |||
52 | 53 | ||
53 | #include <asm/xen/hypervisor.h> | 54 | #include <asm/xen/hypervisor.h> |
54 | #include <asm/xen/hypercall.h> | 55 | #include <asm/xen/hypercall.h> |
56 | |||
57 | #include <xen/xen.h> | ||
55 | #include <xen/interface/xen.h> | 58 | #include <xen/interface/xen.h> |
56 | #include <xen/interface/memory.h> | 59 | #include <xen/interface/memory.h> |
57 | #include <xen/xenbus.h> | 60 | #include <xen/xenbus.h> |
@@ -66,8 +69,6 @@ struct balloon_stats { | |||
66 | /* We aim for 'current allocation' == 'target allocation'. */ | 69 | /* We aim for 'current allocation' == 'target allocation'. */ |
67 | unsigned long current_pages; | 70 | unsigned long current_pages; |
68 | unsigned long target_pages; | 71 | unsigned long target_pages; |
69 | /* We may hit the hard limit in Xen. If we do then we remember it. */ | ||
70 | unsigned long hard_limit; | ||
71 | /* | 72 | /* |
72 | * Drivers may alter the memory reservation independently, but they | 73 | * Drivers may alter the memory reservation independently, but they |
73 | * must inform the balloon driver so we avoid hitting the hard limit. | 74 | * must inform the balloon driver so we avoid hitting the hard limit. |
@@ -136,6 +137,8 @@ static void balloon_append(struct page *page) | |||
136 | list_add(&page->lru, &ballooned_pages); | 137 | list_add(&page->lru, &ballooned_pages); |
137 | balloon_stats.balloon_low++; | 138 | balloon_stats.balloon_low++; |
138 | } | 139 | } |
140 | |||
141 | totalram_pages--; | ||
139 | } | 142 | } |
140 | 143 | ||
141 | /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */ | 144 | /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */ |
@@ -156,6 +159,8 @@ static struct page *balloon_retrieve(void) | |||
156 | else | 159 | else |
157 | balloon_stats.balloon_low--; | 160 | balloon_stats.balloon_low--; |
158 | 161 | ||
162 | totalram_pages++; | ||
163 | |||
159 | return page; | 164 | return page; |
160 | } | 165 | } |
161 | 166 | ||
@@ -181,7 +186,7 @@ static void balloon_alarm(unsigned long unused) | |||
181 | 186 | ||
182 | static unsigned long current_target(void) | 187 | static unsigned long current_target(void) |
183 | { | 188 | { |
184 | unsigned long target = min(balloon_stats.target_pages, balloon_stats.hard_limit); | 189 | unsigned long target = balloon_stats.target_pages; |
185 | 190 | ||
186 | target = min(target, | 191 | target = min(target, |
187 | balloon_stats.current_pages + | 192 | balloon_stats.current_pages + |
@@ -217,23 +222,10 @@ static int increase_reservation(unsigned long nr_pages) | |||
217 | set_xen_guest_handle(reservation.extent_start, frame_list); | 222 | set_xen_guest_handle(reservation.extent_start, frame_list); |
218 | reservation.nr_extents = nr_pages; | 223 | reservation.nr_extents = nr_pages; |
219 | rc = HYPERVISOR_memory_op(XENMEM_populate_physmap, &reservation); | 224 | rc = HYPERVISOR_memory_op(XENMEM_populate_physmap, &reservation); |
220 | if (rc < nr_pages) { | 225 | if (rc < 0) |
221 | if (rc > 0) { | ||
222 | int ret; | ||
223 | |||
224 | /* We hit the Xen hard limit: reprobe. */ | ||
225 | reservation.nr_extents = rc; | ||
226 | ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, | ||
227 | &reservation); | ||
228 | BUG_ON(ret != rc); | ||
229 | } | ||
230 | if (rc >= 0) | ||
231 | balloon_stats.hard_limit = (balloon_stats.current_pages + rc - | ||
232 | balloon_stats.driver_pages); | ||
233 | goto out; | 226 | goto out; |
234 | } | ||
235 | 227 | ||
236 | for (i = 0; i < nr_pages; i++) { | 228 | for (i = 0; i < rc; i++) { |
237 | page = balloon_retrieve(); | 229 | page = balloon_retrieve(); |
238 | BUG_ON(page == NULL); | 230 | BUG_ON(page == NULL); |
239 | 231 | ||
@@ -259,13 +251,12 @@ static int increase_reservation(unsigned long nr_pages) | |||
259 | __free_page(page); | 251 | __free_page(page); |
260 | } | 252 | } |
261 | 253 | ||
262 | balloon_stats.current_pages += nr_pages; | 254 | balloon_stats.current_pages += rc; |
263 | totalram_pages = balloon_stats.current_pages; | ||
264 | 255 | ||
265 | out: | 256 | out: |
266 | spin_unlock_irqrestore(&balloon_lock, flags); | 257 | spin_unlock_irqrestore(&balloon_lock, flags); |
267 | 258 | ||
268 | return 0; | 259 | return rc < 0 ? rc : rc != nr_pages; |
269 | } | 260 | } |
270 | 261 | ||
271 | static int decrease_reservation(unsigned long nr_pages) | 262 | static int decrease_reservation(unsigned long nr_pages) |
@@ -323,7 +314,6 @@ static int decrease_reservation(unsigned long nr_pages) | |||
323 | BUG_ON(ret != nr_pages); | 314 | BUG_ON(ret != nr_pages); |
324 | 315 | ||
325 | balloon_stats.current_pages -= nr_pages; | 316 | balloon_stats.current_pages -= nr_pages; |
326 | totalram_pages = balloon_stats.current_pages; | ||
327 | 317 | ||
328 | spin_unlock_irqrestore(&balloon_lock, flags); | 318 | spin_unlock_irqrestore(&balloon_lock, flags); |
329 | 319 | ||
@@ -367,7 +357,6 @@ static void balloon_process(struct work_struct *work) | |||
367 | static void balloon_set_new_target(unsigned long target) | 357 | static void balloon_set_new_target(unsigned long target) |
368 | { | 358 | { |
369 | /* No need for lock. Not read-modify-write updates. */ | 359 | /* No need for lock. Not read-modify-write updates. */ |
370 | balloon_stats.hard_limit = ~0UL; | ||
371 | balloon_stats.target_pages = target; | 360 | balloon_stats.target_pages = target; |
372 | schedule_work(&balloon_worker); | 361 | schedule_work(&balloon_worker); |
373 | } | 362 | } |
@@ -422,12 +411,10 @@ static int __init balloon_init(void) | |||
422 | pr_info("xen_balloon: Initialising balloon driver.\n"); | 411 | pr_info("xen_balloon: Initialising balloon driver.\n"); |
423 | 412 | ||
424 | balloon_stats.current_pages = min(xen_start_info->nr_pages, max_pfn); | 413 | balloon_stats.current_pages = min(xen_start_info->nr_pages, max_pfn); |
425 | totalram_pages = balloon_stats.current_pages; | ||
426 | balloon_stats.target_pages = balloon_stats.current_pages; | 414 | balloon_stats.target_pages = balloon_stats.current_pages; |
427 | balloon_stats.balloon_low = 0; | 415 | balloon_stats.balloon_low = 0; |
428 | balloon_stats.balloon_high = 0; | 416 | balloon_stats.balloon_high = 0; |
429 | balloon_stats.driver_pages = 0UL; | 417 | balloon_stats.driver_pages = 0UL; |
430 | balloon_stats.hard_limit = ~0UL; | ||
431 | 418 | ||
432 | init_timer(&balloon_timer); | 419 | init_timer(&balloon_timer); |
433 | balloon_timer.data = 0; | 420 | balloon_timer.data = 0; |
@@ -472,9 +459,6 @@ module_exit(balloon_exit); | |||
472 | BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages)); | 459 | BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages)); |
473 | BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low)); | 460 | BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low)); |
474 | BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high)); | 461 | BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high)); |
475 | BALLOON_SHOW(hard_limit_kb, | ||
476 | (balloon_stats.hard_limit!=~0UL) ? "%lu\n" : "???\n", | ||
477 | (balloon_stats.hard_limit!=~0UL) ? PAGES2KB(balloon_stats.hard_limit) : 0); | ||
478 | BALLOON_SHOW(driver_kb, "%lu\n", PAGES2KB(balloon_stats.driver_pages)); | 462 | BALLOON_SHOW(driver_kb, "%lu\n", PAGES2KB(balloon_stats.driver_pages)); |
479 | 463 | ||
480 | static ssize_t show_target_kb(struct sys_device *dev, struct sysdev_attribute *attr, | 464 | static ssize_t show_target_kb(struct sys_device *dev, struct sysdev_attribute *attr, |
@@ -544,7 +528,6 @@ static struct attribute *balloon_info_attrs[] = { | |||
544 | &attr_current_kb.attr, | 528 | &attr_current_kb.attr, |
545 | &attr_low_kb.attr, | 529 | &attr_low_kb.attr, |
546 | &attr_high_kb.attr, | 530 | &attr_high_kb.attr, |
547 | &attr_hard_limit_kb.attr, | ||
548 | &attr_driver_kb.attr, | 531 | &attr_driver_kb.attr, |
549 | NULL | 532 | NULL |
550 | }; | 533 | }; |
diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c index bdfd584ad853..14e2d995e958 100644 --- a/drivers/xen/cpu_hotplug.c +++ b/drivers/xen/cpu_hotplug.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <linux/notifier.h> | 1 | #include <linux/notifier.h> |
2 | 2 | ||
3 | #include <xen/xen.h> | ||
3 | #include <xen/xenbus.h> | 4 | #include <xen/xenbus.h> |
4 | 5 | ||
5 | #include <asm/xen/hypervisor.h> | 6 | #include <asm/xen/hypervisor.h> |
@@ -86,7 +87,7 @@ static int setup_cpu_watcher(struct notifier_block *notifier, | |||
86 | for_each_possible_cpu(cpu) { | 87 | for_each_possible_cpu(cpu) { |
87 | if (vcpu_online(cpu) == 0) { | 88 | if (vcpu_online(cpu) == 0) { |
88 | (void)cpu_down(cpu); | 89 | (void)cpu_down(cpu); |
89 | cpu_clear(cpu, cpu_present_map); | 90 | set_cpu_present(cpu, false); |
90 | } | 91 | } |
91 | } | 92 | } |
92 | 93 | ||
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 2f57276e87a2..db8f506817f0 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/string.h> | 28 | #include <linux/string.h> |
29 | #include <linux/bootmem.h> | 29 | #include <linux/bootmem.h> |
30 | #include <linux/slab.h> | ||
30 | 31 | ||
31 | #include <asm/ptrace.h> | 32 | #include <asm/ptrace.h> |
32 | #include <asm/irq.h> | 33 | #include <asm/irq.h> |
@@ -474,6 +475,9 @@ static void unbind_from_irq(unsigned int irq) | |||
474 | bind_evtchn_to_cpu(evtchn, 0); | 475 | bind_evtchn_to_cpu(evtchn, 0); |
475 | 476 | ||
476 | evtchn_to_irq[evtchn] = -1; | 477 | evtchn_to_irq[evtchn] = -1; |
478 | } | ||
479 | |||
480 | if (irq_info[irq].type != IRQT_UNBOUND) { | ||
477 | irq_info[irq] = mk_unbound_info(); | 481 | irq_info[irq] = mk_unbound_info(); |
478 | 482 | ||
479 | dynamic_irq_cleanup(irq); | 483 | dynamic_irq_cleanup(irq); |
@@ -646,9 +650,13 @@ void xen_evtchn_do_upcall(struct pt_regs *regs) | |||
646 | int bit_idx = __ffs(pending_bits); | 650 | int bit_idx = __ffs(pending_bits); |
647 | int port = (word_idx * BITS_PER_LONG) + bit_idx; | 651 | int port = (word_idx * BITS_PER_LONG) + bit_idx; |
648 | int irq = evtchn_to_irq[port]; | 652 | int irq = evtchn_to_irq[port]; |
653 | struct irq_desc *desc; | ||
649 | 654 | ||
650 | if (irq != -1) | 655 | if (irq != -1) { |
651 | handle_irq(irq, regs); | 656 | desc = irq_to_desc(irq); |
657 | if (desc) | ||
658 | generic_handle_irq_desc(irq, desc); | ||
659 | } | ||
652 | } | 660 | } |
653 | } | 661 | } |
654 | 662 | ||
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index 79bedba44fee..66e185cfe92f 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c | |||
@@ -45,9 +45,10 @@ | |||
45 | #include <linux/poll.h> | 45 | #include <linux/poll.h> |
46 | #include <linux/irq.h> | 46 | #include <linux/irq.h> |
47 | #include <linux/init.h> | 47 | #include <linux/init.h> |
48 | #include <linux/gfp.h> | ||
49 | #include <linux/mutex.h> | 48 | #include <linux/mutex.h> |
50 | #include <linux/cpu.h> | 49 | #include <linux/cpu.h> |
50 | |||
51 | #include <xen/xen.h> | ||
51 | #include <xen/events.h> | 52 | #include <xen/events.h> |
52 | #include <xen/evtchn.h> | 53 | #include <xen/evtchn.h> |
53 | #include <asm/xen/hypervisor.h> | 54 | #include <asm/xen/hypervisor.h> |
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 7d8f531fb8e8..f66db3b91d61 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -34,9 +34,11 @@ | |||
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/sched.h> | 35 | #include <linux/sched.h> |
36 | #include <linux/mm.h> | 36 | #include <linux/mm.h> |
37 | #include <linux/slab.h> | ||
37 | #include <linux/vmalloc.h> | 38 | #include <linux/vmalloc.h> |
38 | #include <linux/uaccess.h> | 39 | #include <linux/uaccess.h> |
39 | 40 | ||
41 | #include <xen/xen.h> | ||
40 | #include <xen/interface/xen.h> | 42 | #include <xen/interface/xen.h> |
41 | #include <xen/page.h> | 43 | #include <xen/page.h> |
42 | #include <xen/grant_table.h> | 44 | #include <xen/grant_table.h> |
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 10d03d7931c4..2ac4440e7b08 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -3,6 +3,7 @@ | |||
3 | */ | 3 | */ |
4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
5 | #include <linux/err.h> | 5 | #include <linux/err.h> |
6 | #include <linux/slab.h> | ||
6 | #include <linux/reboot.h> | 7 | #include <linux/reboot.h> |
7 | #include <linux/sysrq.h> | 8 | #include <linux/sysrq.h> |
8 | #include <linux/stop_machine.h> | 9 | #include <linux/stop_machine.h> |
@@ -43,7 +44,6 @@ static int xen_suspend(void *data) | |||
43 | if (err) { | 44 | if (err) { |
44 | printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n", | 45 | printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n", |
45 | err); | 46 | err); |
46 | dpm_resume_noirq(PMSG_RESUME); | ||
47 | return err; | 47 | return err; |
48 | } | 48 | } |
49 | 49 | ||
@@ -69,7 +69,6 @@ static int xen_suspend(void *data) | |||
69 | } | 69 | } |
70 | 70 | ||
71 | sysdev_resume(); | 71 | sysdev_resume(); |
72 | dpm_resume_noirq(PMSG_RESUME); | ||
73 | 72 | ||
74 | return 0; | 73 | return 0; |
75 | } | 74 | } |
@@ -81,6 +80,12 @@ static void do_suspend(void) | |||
81 | 80 | ||
82 | shutting_down = SHUTDOWN_SUSPEND; | 81 | shutting_down = SHUTDOWN_SUSPEND; |
83 | 82 | ||
83 | err = stop_machine_create(); | ||
84 | if (err) { | ||
85 | printk(KERN_ERR "xen suspend: failed to setup stop_machine %d\n", err); | ||
86 | goto out; | ||
87 | } | ||
88 | |||
84 | #ifdef CONFIG_PREEMPT | 89 | #ifdef CONFIG_PREEMPT |
85 | /* If the kernel is preemptible, we need to freeze all the processes | 90 | /* If the kernel is preemptible, we need to freeze all the processes |
86 | to prevent them from being in the middle of a pagetable update | 91 | to prevent them from being in the middle of a pagetable update |
@@ -88,14 +93,14 @@ static void do_suspend(void) | |||
88 | err = freeze_processes(); | 93 | err = freeze_processes(); |
89 | if (err) { | 94 | if (err) { |
90 | printk(KERN_ERR "xen suspend: freeze failed %d\n", err); | 95 | printk(KERN_ERR "xen suspend: freeze failed %d\n", err); |
91 | return; | 96 | goto out_destroy_sm; |
92 | } | 97 | } |
93 | #endif | 98 | #endif |
94 | 99 | ||
95 | err = dpm_suspend_start(PMSG_SUSPEND); | 100 | err = dpm_suspend_start(PMSG_SUSPEND); |
96 | if (err) { | 101 | if (err) { |
97 | printk(KERN_ERR "xen suspend: dpm_suspend_start %d\n", err); | 102 | printk(KERN_ERR "xen suspend: dpm_suspend_start %d\n", err); |
98 | goto out; | 103 | goto out_thaw; |
99 | } | 104 | } |
100 | 105 | ||
101 | printk(KERN_DEBUG "suspending xenstore...\n"); | 106 | printk(KERN_DEBUG "suspending xenstore...\n"); |
@@ -104,32 +109,39 @@ static void do_suspend(void) | |||
104 | err = dpm_suspend_noirq(PMSG_SUSPEND); | 109 | err = dpm_suspend_noirq(PMSG_SUSPEND); |
105 | if (err) { | 110 | if (err) { |
106 | printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err); | 111 | printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err); |
107 | goto resume_devices; | 112 | goto out_resume; |
108 | } | 113 | } |
109 | 114 | ||
110 | err = stop_machine(xen_suspend, &cancelled, cpumask_of(0)); | 115 | err = stop_machine(xen_suspend, &cancelled, cpumask_of(0)); |
116 | |||
117 | dpm_resume_noirq(PMSG_RESUME); | ||
118 | |||
111 | if (err) { | 119 | if (err) { |
112 | printk(KERN_ERR "failed to start xen_suspend: %d\n", err); | 120 | printk(KERN_ERR "failed to start xen_suspend: %d\n", err); |
113 | goto out; | 121 | cancelled = 1; |
114 | } | 122 | } |
115 | 123 | ||
124 | out_resume: | ||
116 | if (!cancelled) { | 125 | if (!cancelled) { |
117 | xen_arch_resume(); | 126 | xen_arch_resume(); |
118 | xs_resume(); | 127 | xs_resume(); |
119 | } else | 128 | } else |
120 | xs_suspend_cancel(); | 129 | xs_suspend_cancel(); |
121 | 130 | ||
122 | dpm_resume_noirq(PMSG_RESUME); | ||
123 | |||
124 | resume_devices: | ||
125 | dpm_resume_end(PMSG_RESUME); | 131 | dpm_resume_end(PMSG_RESUME); |
126 | 132 | ||
127 | /* Make sure timer events get retriggered on all CPUs */ | 133 | /* Make sure timer events get retriggered on all CPUs */ |
128 | clock_was_set(); | 134 | clock_was_set(); |
129 | out: | 135 | |
136 | out_thaw: | ||
130 | #ifdef CONFIG_PREEMPT | 137 | #ifdef CONFIG_PREEMPT |
131 | thaw_processes(); | 138 | thaw_processes(); |
139 | |||
140 | out_destroy_sm: | ||
132 | #endif | 141 | #endif |
142 | stop_machine_destroy(); | ||
143 | |||
144 | out: | ||
133 | shutting_down = SHUTDOWN_INVALID; | 145 | shutting_down = SHUTDOWN_INVALID; |
134 | } | 146 | } |
135 | #endif /* CONFIG_PM_SLEEP */ | 147 | #endif /* CONFIG_PM_SLEEP */ |
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c index 88a60e03ccf0..60f1827a32cb 100644 --- a/drivers/xen/sys-hypervisor.c +++ b/drivers/xen/sys-hypervisor.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/slab.h> | ||
10 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
11 | #include <linux/module.h> | 12 | #include <linux/module.h> |
12 | #include <linux/kobject.h> | 13 | #include <linux/kobject.h> |
@@ -14,6 +15,7 @@ | |||
14 | #include <asm/xen/hypervisor.h> | 15 | #include <asm/xen/hypervisor.h> |
15 | #include <asm/xen/hypercall.h> | 16 | #include <asm/xen/hypercall.h> |
16 | 17 | ||
18 | #include <xen/xen.h> | ||
17 | #include <xen/xenbus.h> | 19 | #include <xen/xenbus.h> |
18 | #include <xen/interface/xen.h> | 20 | #include <xen/interface/xen.h> |
19 | #include <xen/interface/version.h> | 21 | #include <xen/interface/version.h> |
@@ -425,7 +427,7 @@ static ssize_t hyp_sysfs_store(struct kobject *kobj, | |||
425 | return 0; | 427 | return 0; |
426 | } | 428 | } |
427 | 429 | ||
428 | static struct sysfs_ops hyp_sysfs_ops = { | 430 | static const struct sysfs_ops hyp_sysfs_ops = { |
429 | .show = hyp_sysfs_show, | 431 | .show = hyp_sysfs_show, |
430 | .store = hyp_sysfs_store, | 432 | .store = hyp_sysfs_store, |
431 | }; | 433 | }; |
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 | } |
diff --git a/drivers/xen/xencomm.c b/drivers/xen/xencomm.c index a240b2c20b99..b91f8ff50d05 100644 --- a/drivers/xen/xencomm.c +++ b/drivers/xen/xencomm.c | |||
@@ -18,8 +18,8 @@ | |||
18 | * Authors: Hollis Blanchard <hollisb@us.ibm.com> | 18 | * Authors: Hollis Blanchard <hollisb@us.ibm.com> |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/gfp.h> | ||
22 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
22 | #include <linux/slab.h> | ||
23 | #include <asm/page.h> | 23 | #include <asm/page.h> |
24 | #include <xen/xencomm.h> | 24 | #include <xen/xencomm.h> |
25 | #include <xen/interface/xen.h> | 25 | #include <xen/interface/xen.h> |
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c index 6559e0c752ce..8924d93136f1 100644 --- a/drivers/xen/xenfs/super.c +++ b/drivers/xen/xenfs/super.c | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
14 | #include <linux/magic.h> | 14 | #include <linux/magic.h> |
15 | 15 | ||
16 | #include <xen/xen.h> | ||
17 | |||
16 | #include "xenfs.h" | 18 | #include "xenfs.h" |
17 | 19 | ||
18 | #include <asm/xen/hypervisor.h> | 20 | #include <asm/xen/hypervisor.h> |
diff --git a/drivers/xen/xenfs/xenbus.c b/drivers/xen/xenfs/xenbus.c index 6c4269b836b7..f28ece397361 100644 --- a/drivers/xen/xenfs/xenbus.c +++ b/drivers/xen/xenfs/xenbus.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/init.h> | 51 | #include <linux/init.h> |
52 | #include <linux/namei.h> | 52 | #include <linux/namei.h> |
53 | #include <linux/string.h> | 53 | #include <linux/string.h> |
54 | #include <linux/slab.h> | ||
54 | 55 | ||
55 | #include "xenfs.h" | 56 | #include "xenfs.h" |
56 | #include "../xenbus/xenbus_comms.h" | 57 | #include "../xenbus/xenbus_comms.h" |