From 9a5a2cac9f99c98d9d15cec17b1904f29d0e8009 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Mar 2009 17:46:42 +0000 Subject: xen: resume interrupts before system devices. Impact: bugfix Xen domain restore Otherwise the first timer interrupt after resume is missed and we never get another. Signed-off-by: Ian Campbell Signed-off-by: Jeremy Fitzhardinge --- drivers/xen/manage.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/xen') diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 0d61db1e7b49..4b5b84837ee1 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c @@ -62,14 +62,15 @@ static int xen_suspend(void *data) gnttab_resume(); xen_mm_unpin_all(); - sysdev_resume(); - if (!*cancelled) { xen_irq_resume(); xen_console_resume(); xen_timer_resume(); } + sysdev_resume(); + device_power_up(PMSG_RESUME); + return 0; } -- cgit v1.2.3-59-g8ed1b From d745562cc40bff60f0597004d8128fa0225cc267 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 2 Apr 2009 13:24:28 +0100 Subject: xen: honour VCPU availability on boot If a VM is booted with offline VCPUs then unplug them during boot. Determining the availability of a VCPU requires access to XenStore which is not available at the point smp_prepare_cpus() is called, therefore we bring up all VCPUS initially and unplug the offline ones as soon as XenStore becomes available. Signed-off-by: Ian Campbell --- drivers/xen/cpu_hotplug.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) (limited to 'drivers/xen') diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c index 5f54c01c1568..bdfd584ad853 100644 --- a/drivers/xen/cpu_hotplug.c +++ b/drivers/xen/cpu_hotplug.c @@ -21,29 +21,41 @@ static void disable_hotplug_cpu(int cpu) set_cpu_present(cpu, false); } -static void vcpu_hotplug(unsigned int cpu) +static int vcpu_online(unsigned int cpu) { int err; char dir[32], state[32]; - if (!cpu_possible(cpu)) - return; - sprintf(dir, "cpu/%u", cpu); err = xenbus_scanf(XBT_NIL, dir, "availability", "%s", state); if (err != 1) { printk(KERN_ERR "XENBUS: Unable to read cpu state\n"); - return; + return err; } - if (strcmp(state, "online") == 0) { + if (strcmp(state, "online") == 0) + return 1; + else if (strcmp(state, "offline") == 0) + return 0; + + printk(KERN_ERR "XENBUS: unknown state(%s) on CPU%d\n", state, cpu); + return -EINVAL; +} +static void vcpu_hotplug(unsigned int cpu) +{ + if (!cpu_possible(cpu)) + return; + + switch (vcpu_online(cpu)) { + case 1: enable_hotplug_cpu(cpu); - } else if (strcmp(state, "offline") == 0) { + break; + case 0: (void)cpu_down(cpu); disable_hotplug_cpu(cpu); - } else { - printk(KERN_ERR "XENBUS: unknown state(%s) on CPU%d\n", - state, cpu); + break; + default: + break; } } @@ -64,12 +76,20 @@ static void handle_vcpu_hotplug_event(struct xenbus_watch *watch, static int setup_cpu_watcher(struct notifier_block *notifier, unsigned long event, void *data) { + int cpu; static struct xenbus_watch cpu_watch = { .node = "cpu", .callback = handle_vcpu_hotplug_event}; (void)register_xenbus_watch(&cpu_watch); + for_each_possible_cpu(cpu) { + if (vcpu_online(cpu) == 0) { + (void)cpu_down(cpu); + cpu_clear(cpu, cpu_present_map); + } + } + return NOTIFY_DONE; } -- cgit v1.2.3-59-g8ed1b From 0692698cb7369ea1ce74f3f87f70baf5072f8a37 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Tue, 5 May 2009 13:57:52 +0100 Subject: [IA64] xen_domu_defconfig: fix build issues/warnings - drivers/xen/events.c did not compile - xen_setup_hook caused a modpost section warning - the use of u64 (instead of unsigned long long) together with a %llu in drivers/xen/balloon.c caused a compiler warning Signed-off-by: Jan Beulich Signed-off-by: Tony Luck --- arch/ia64/include/asm/idle.h | 7 +++++++ arch/ia64/include/asm/xen/events.h | 7 +------ arch/ia64/xen/xensetup.S | 2 -- drivers/xen/balloon.c | 3 ++- 4 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 arch/ia64/include/asm/idle.h (limited to 'drivers/xen') diff --git a/arch/ia64/include/asm/idle.h b/arch/ia64/include/asm/idle.h new file mode 100644 index 000000000000..b7685015a8ba --- /dev/null +++ b/arch/ia64/include/asm/idle.h @@ -0,0 +1,7 @@ +#ifndef _ASM_IA64_IDLE_H +#define _ASM_IA64_IDLE_H + +static inline void enter_idle(void) { } +static inline void exit_idle(void) { } + +#endif /* _ASM_IA64_IDLE_H */ diff --git a/arch/ia64/include/asm/xen/events.h b/arch/ia64/include/asm/xen/events.h index 73248781fba8..b8370c8b6198 100644 --- a/arch/ia64/include/asm/xen/events.h +++ b/arch/ia64/include/asm/xen/events.h @@ -36,14 +36,9 @@ static inline int xen_irqs_disabled(struct pt_regs *regs) return !(ia64_psr(regs)->i); } -static inline void xen_do_IRQ(int irq, struct pt_regs *regs) +static inline void handle_irq(int irq, struct pt_regs *regs) { - struct pt_regs *old_regs; - old_regs = set_irq_regs(regs); - irq_enter(); __do_IRQ(irq); - irq_exit(); - set_irq_regs(old_regs); } #define irq_ctx_init(cpu) do { } while (0) diff --git a/arch/ia64/xen/xensetup.S b/arch/ia64/xen/xensetup.S index 28fed1fcc079..aff8346ea193 100644 --- a/arch/ia64/xen/xensetup.S +++ b/arch/ia64/xen/xensetup.S @@ -54,8 +54,6 @@ END(startup_xen) #define isBP p3 // are we the Bootstrap Processor? - .text - GLOBAL_ENTRY(xen_setup_hook) mov r8=XEN_PV_DOMAIN_ASM (isBP) movl r9=xen_domain_type;; diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index efa4b363ce72..f5bbd9e83416 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -513,7 +513,8 @@ static ssize_t show_target(struct sys_device *dev, struct sysdev_attribute *attr char *buf) { return sprintf(buf, "%llu\n", - (u64)balloon_stats.target_pages << PAGE_SHIFT); + (unsigned long long)balloon_stats.target_pages + << PAGE_SHIFT); } static ssize_t store_target(struct sys_device *dev, -- cgit v1.2.3-59-g8ed1b