WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH] Fix cpu offline bug

To: "Liu, Jinsong" <jinsong.liu@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] Fix cpu offline bug
From: Keir Fraser <keir.xen@xxxxxxxxx>
Date: Sat, 05 Mar 2011 15:57:01 +0000
Cc: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>, "Li, Xin" <xin.li@xxxxxxxxx>
Delivery-date: Sat, 05 Mar 2011 07:58:38 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:user-agent:date:subject:from:to:cc:message-id :thread-topic:thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; bh=eD6WONoWwnBlfbaFaE2Glpcc+od5P8Tw+Z3ZIYRLUpE=; b=Wz3iIo021Zvk/gf+rh+w73B77IRTxUP6X36nhLzab0vdFTaT2bus2ul6Q2dueXpt79 1GdG5lqSOApHeZ+lU1hxMrpJravbcd0EBRXnqRcthjM6sbYqViviZXaLDsRO6UWb4oQh QPjqvfMZxHnNa4VYoFlwENJe80BmGl5pl2PBE=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=user-agent:date:subject:from:to:cc:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; b=fxo+ULdEqQi4KffAIlG4U17HKx3TQkqsfGyaf6M7kPePsaQYN2J+PH9IahrmfJw1Zx XUlpc4ZqYU85Pb26Oj7iyJ93ifJIEWoCU8Ik6+b2CkU88zC0448uXqNcHVECcJAp2IaM p/Cjg8Q3UqsmCLU4pfohkuLwzCV26PI9ccEfU=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <BC00F5384FCFC9499AF06F92E8B78A9E1FA4F5A909@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcvaVg/u0QwvoHZBRPSNM5hGIfEKXQA1AXOCAAcrBLAAAc1Big==
Thread-topic: [PATCH] Fix cpu offline bug
User-agent: Microsoft-Entourage/12.28.0.101117
Urk, good point!

 Thanks,
 Keir


On 05/03/2011 15:10, "Liu, Jinsong" <jinsong.liu@xxxxxxxxx> wrote:

> Keir,
> 
> Thanks for comments and update!
> However, I think we still need update it a little :)
> 
> =============================
> Fix cpu offline bug
> 
> Remove BUG_ON since it's of some risk, considering the small time window:
> cpu0 read (cpu_state) --> offlining cpu write (cpu_state) --> cpu0 read
> (cpu_state)
> 
> Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>
> 
> diff -r 1ecb840bea17 xen/arch/x86/smpboot.c
> --- a/xen/arch/x86/smpboot.c    Sat Mar 05 23:30:29 2022 +0800
> +++ b/xen/arch/x86/smpboot.c    Sun Mar 06 01:21:34 2022 +0800
> @@ -864,7 +864,6 @@ void __cpu_die(unsigned int cpu)
> 
>      while ( cpu_state != CPU_STATE_DEAD )
>      {
> -        BUG_ON(cpu_state != CPU_STATE_DYING);
>          mdelay(100);
>          cpu_relax();
>          process_pending_softirqs();
> =============================
> 
> Thanks,
> Jinsong
> 
> 
> 
> Keir Fraser wrote:
>> On 04/03/2011 10:22, "Liu, Jinsong" <jinsong.liu@xxxxxxxxx> 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.
>> 
>> Alternative fix applied tio unstable and 4.1-testing. The fix below
>> doesn't account for the fact that cpu_state can also ==
>> CPU_STATE_DEAD after an (unsuccessful) CPU online operation.
>> 
>>  -- Keir
>> 
>>> Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>
>>> 
>>> 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)
> 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel