From 06d0b5d9edcecccab45588a472cd34af2608e665 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Mon, 17 Dec 2012 20:29:32 -0500 Subject: [PATCH 1/3] xen/smp: Use smp_store_boot_cpu_info() to store cpu info for BSP during boot time. Git commit 30106c174311b8cfaaa3186c7f6f9c36c62d17da ("x86, hotplug: Support functions for CPU0 online/offline") alters what the call to smp_store_cpu_info() does. For BSP we should use the smp_store_boot_cpu_info() and for secondary CPU's the old variant of smp_store_cpu_info() should be used. This fixes the regression introduced by said commit. Reported-and-Tested-by: Sander Eikelenboom Signed-off-by: Konrad Rzeszutek Wilk --- arch/x86/xen/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index 353c50f1870..4f7d2599b48 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c @@ -254,7 +254,7 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus) } xen_init_lock_cpu(0); - smp_store_cpu_info(0); + smp_store_boot_cpu_info(); cpu_data(0).x86_max_cores = 1; for_each_possible_cpu(i) { From cc31fd9c4f8fc466ec8488d617150e751f643903 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 13 Dec 2012 15:31:35 +0000 Subject: [PATCH 2/3] xen: Add EVTCHNOP_reset in Xen interface header files. Signed-off-by: Wei Liu Signed-off-by: Konrad Rzeszutek Wilk --- include/xen/interface/event_channel.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/xen/interface/event_channel.h b/include/xen/interface/event_channel.h index 2090881c365..f4942921e20 100644 --- a/include/xen/interface/event_channel.h +++ b/include/xen/interface/event_channel.h @@ -177,6 +177,19 @@ struct evtchn_unmask { evtchn_port_t port; }; +/* + * EVTCHNOP_reset: Close all event channels associated with specified domain. + * NOTES: + * 1. may be specified as DOMID_SELF. + * 2. Only a sufficiently-privileged domain may specify other than DOMID_SELF. + */ +#define EVTCHNOP_reset 10 +struct evtchn_reset { + /* IN parameters. */ + domid_t dom; +}; +typedef struct evtchn_reset evtchn_reset_t; + struct evtchn_op { uint32_t cmd; /* EVTCHNOP_* */ union { From 9d328a948f38ec240fc6d05db2c146e23ccd9b8b Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 13 Dec 2012 15:33:05 +0000 Subject: [PATCH 3/3] xen/vcpu: Fix vcpu restore path. The runstate of vcpu should be restored for all possible cpus, as well as the vcpu info placement. Acked-by: Jan Beulich Signed-off-by: Wei Liu Signed-off-by: Konrad Rzeszutek Wilk --- arch/x86/xen/enlighten.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 3aeaa933b52..138e5667409 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -193,10 +193,11 @@ void xen_vcpu_restore(void) { int cpu; - for_each_online_cpu(cpu) { + for_each_possible_cpu(cpu) { bool other_cpu = (cpu != smp_processor_id()); + bool is_up = HYPERVISOR_vcpu_op(VCPUOP_is_up, cpu, NULL); - if (other_cpu && + if (other_cpu && is_up && HYPERVISOR_vcpu_op(VCPUOP_down, cpu, NULL)) BUG(); @@ -205,7 +206,7 @@ void xen_vcpu_restore(void) if (have_vcpu_info_placement) xen_vcpu_setup(cpu); - if (other_cpu && + if (other_cpu && is_up && HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL)) BUG(); }