debuggers.hg
changeset 21155:7794f61c61f3
x86, cpu hotplug: Synchronise vcpu state earlier during cpu offline.
Needs to happen before non-idle VCPU is fully descheduled after CPU is
removed from cpu_online_map. Else sync_vcpu_execstate() doesn't work
properly.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Needs to happen before non-idle VCPU is fully descheduled after CPU is
removed from cpu_online_map. Else sync_vcpu_execstate() doesn't work
properly.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Wed Apr 07 08:09:00 2010 +0100 (2010-04-07) |
parents | adce8bc43fcc |
children | d791173ca65b |
files | xen/arch/x86/domain.c xen/arch/x86/smpboot.c |
line diff
1.1 --- a/xen/arch/x86/domain.c Tue Apr 06 07:16:47 2010 +0100 1.2 +++ b/xen/arch/x86/domain.c Wed Apr 07 08:09:00 2010 +0100 1.3 @@ -1442,7 +1442,8 @@ void context_switch(struct vcpu *prev, s 1.4 1.5 set_current(next); 1.6 1.7 - if ( (per_cpu(curr_vcpu, cpu) == next) || is_idle_vcpu(next) ) 1.8 + if ( (per_cpu(curr_vcpu, cpu) == next) || 1.9 + (is_idle_vcpu(next) && cpu_online(cpu)) ) 1.10 { 1.11 local_irq_enable(); 1.12 }
2.1 --- a/xen/arch/x86/smpboot.c Tue Apr 06 07:16:47 2010 +0100 2.2 +++ b/xen/arch/x86/smpboot.c Wed Apr 07 08:09:00 2010 +0100 2.3 @@ -997,17 +997,13 @@ static int __devinit do_boot_cpu(int api 2.4 return boot_error; 2.5 } 2.6 2.7 -static void idle_task_exit(void) 2.8 -{ 2.9 - /* Give up lazy state borrowed by this idle vcpu */ 2.10 - __sync_lazy_execstate(); 2.11 -} 2.12 - 2.13 void cpu_exit_clear(void) 2.14 { 2.15 int cpu = raw_smp_processor_id(); 2.16 2.17 - idle_task_exit(); 2.18 + /* Previous non-idle state should be synchronised already. */ 2.19 + if (__sync_lazy_execstate()) 2.20 + BUG(); 2.21 2.22 cpucount --; 2.23 cpu_uninit(); 2.24 @@ -1302,6 +1298,13 @@ int __cpu_disable(void) 2.25 2.26 remove_siblinginfo(cpu); 2.27 2.28 + /* 2.29 + * If we are running the idle vcpu, sync last non-idle vcpu's state 2.30 + * before changing cpu_online_map. If we are running non-idle vcpu, 2.31 + * we will synchronously sync the state in context_switch() later. 2.32 + */ 2.33 + __sync_lazy_execstate(); 2.34 + 2.35 /* It's now safe to remove this processor from the online map */ 2.36 cpu_clear(cpu, cpu_online_map); 2.37 fixup_irqs();