From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH] Fix cpu offline bug Date: Fri, 04 Mar 2011 10:49:05 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Liu, Jinsong" , "xen-devel@lists.xensource.com" Cc: "Jiang, Yunhong" , "Li, Xin" List-Id: xen-devel@lists.xenproject.org Good fix of a nasty bug! I think I will refactor this a bit and do it slightly differently, but the (simple) principle will of course be the same. Thanks, Keir On 04/03/2011 10:22, "Liu, Jinsong" wrote: > Fix cpu offline bug > > At current xen, when cpu offline, cpu0 will wait the 1st cpu offline; > However, if offline 2nd, 3rd, ... cpu, cpu0 will not wait it. > This patch is used to fix the bug. > > Signed-off-by: Liu, Jinsong > > diff -r d1631540bcc4 xen/arch/x86/smpboot.c > --- a/xen/arch/x86/smpboot.c Tue Jan 18 17:23:24 2011 +0000 > +++ b/xen/arch/x86/smpboot.c Sat Feb 12 03:48:09 2011 +0800 > @@ -78,7 +78,8 @@ static enum cpu_state { > CPU_STATE_INIT, /* master -> slave: Early bringup phase 1 */ > CPU_STATE_CALLOUT, /* master -> slave: Early bringup phase 2 */ > CPU_STATE_CALLIN, /* slave -> master: Completed phase 2 */ > - CPU_STATE_ONLINE /* master -> slave: Go fully online now. */ > + CPU_STATE_ONLINE, /* master -> slave: Go fully online now. */ > + CPU_STATE_STAY /* after slave dead, global cpu_state stay here */ > } cpu_state; > #define set_cpu_state(state) do { mb(); cpu_state = (state); } while (0) > > @@ -867,6 +868,8 @@ void __cpu_die(unsigned int cpu) > if ( (++i % 10) == 0 ) > printk(KERN_ERR "CPU %u still not dead...\n", cpu); > } > + > + set_cpu_state(CPU_STATE_STAY); > } > > int cpu_add(uint32_t apic_id, uint32_t acpi_id, uint32_t pxm)