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: [Question] Is it safe to call "xmalloc()" with irq disab

To: Haitao Shan <maillists.shan@xxxxxxxxx>
Subject: [Xen-devel] Re: [Question] Is it safe to call "xmalloc()" with irq disabled?
From: Keir Fraser <keir.xen@xxxxxxxxx>
Date: Tue, 01 Mar 2011 08:50:19 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 01 Mar 2011 00:51:01 -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=0MXooC+jOhe7ZOfAC3HHG/nRso5Rv4gLjeTI+D7Kd5Q=; b=J0FXfLzEd1695PzQfb2E6ygTDll7bMQLP1l2LPYiBDot1PIobKoEk+ItFSadz6xnkE +grzyiFVOyfYZ2RbvPN//wDLhmqTw4LWG17QLIlfYHPrYzhDjvXs/UVunh2i+/gDmUzi aXg9xjZpFGTNLofc63UrWFgGhyz6pSKKJkVxM=
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=vb1S4cq85GCDJentmT5nMp79aHUkEo3ue6D+G9hwqMo6wUMxjZJGctUllBOlq/SUyJ yhOY3Md1zl7AIwKm9nNtxhJPrIxEhCMGLtnu/g5QVCcJoPTtejkQ+AXCrBLipk/FkGod Z7JQObCuPZeccadzjteTGHtT3ehxINl0EcrvE=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <AANLkTiknx0E3k5=4U7A5EfXxHBVRZuK-z8rfhdjNYUTE@xxxxxxxxxxxxxx>
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: AcvX7bEut6RGc4aDNU2QiP/bz19NSw==
Thread-topic: [Question] Is it safe to call "xmalloc()" with irq disabled?
User-agent: Microsoft-Entourage/12.28.0.101117
We need to move dynamic allocation into CPU_UP_PREPARE context. Sadly that
will need surgery on the machine-check cruft. I'll take a look later today
and see if I can do a suitable hatchet job for 4.1.

 -- Keir

On 01/03/2011 08:22, "Haitao Shan" <maillists.shan@xxxxxxxxx> wrote:

> Hi, Keir,
> 
> Below is the log when I met the issue.
>>> ================
>>> (XEN)    ffff83023e257e40 ffff82c48019cc80 0000000100000000
>>> 0000000000000039 (XEN)    ffff82c4802c6a00 0000000000000039
>>> ffff82c4802c6a00 0000000000000039 (XEN)    0000000000000000
>>> 0000000000000000 ffff83023e257e70
>>> ffff82c48019f49a
>>> (XEN)    0000000000000039 ffff82c4802c6a00 ffff83023e257e90
>>> ffff82c48019cb8d (XEN)    0000000000000039 ffff82c4802c6a00
>>> ffff83023e257eb0 ffff82c48017815b (XEN) Xen call trace: (XEN)  
>>> [<ffff82c480177b56>] flush_area_mask+0x1b/0x127 (XEN)  
>>> [<ffff82c480115d69>] alloc_heap_pages+0x5d6/0x61b (XEN)  
>>> [<ffff82c480115e75>] alloc_domheap_pages+0xc7/0x13d (XEN)  
>>> [<ffff82c480115f3b>] alloc_xenheap_pages+0x50/0xd8 (XEN)  
>>> [<ffff82c480129e50>] xmalloc_pool_get+0x2b/0x2d (XEN)  
>>> [<ffff82c48012a674>] xmem_pool_alloc+0x26c/0x4c2 (XEN)  
>>> [<ffff82c48012a9d0>] _xmalloc+0x106/0x1b6 (XEN)  
>>> [<ffff82c48019ec25>] mcabanks_alloc+0x18/0xa4 (XEN)  
>>> [<ffff82c4801a27b6>] intel_mcheck_init+0x21/0x64e (XEN)  
>>> [<ffff82c48019f49a>] mcheck_init+0xdd/0x1b2 (XEN)  
>>> [<ffff82c48019cb8d>] identify_cpu+0x27d/0x282 (XEN)  
>>> [<ffff82c48017815b>] smp_store_cpu_info+0x3b/0xca (XEN)  
>>> [<ffff82c4801782e5>] smp_callin+0x8e/0x157 (XEN)  
>>> [<ffff82c4801799b5>] start_secondary+0xab/0x126 (XEN) (XEN)
>>> (XEN) ****************************************
>>> (XEN) Panic on CPU 57:
>>> (XEN) Assertion 'local_irq_is_enabled()' failed at smp.c:234
>>> (XEN) ****************************************
>>> (XEN)
>>> (XEN) Reboot in five seconds...^M
>>> (XEN) Resetting with ACPI MEMORY or I/O RESET_REG.
>>> ===============
> 
> 2011/3/1 Keir Fraser <keir.xen@xxxxxxxxx>
>> Haitao,
>> 
>> Both _xmalloc and xfree can only safely be called with irqs enabled. I know
>> there is a somewhat suspicious area during CPU bringup where we temporarily
>> disable spinlock debugging. It would be nice to not need this. And for this
>> particular bug you are dealing with, perhaps we can fix it now -- what is
>> the backtrace for the failing allocation?
>> 
>>  -- Keir
>> 
>> On 01/03/2011 07:42, "Haitao Shan" <maillists.shan@xxxxxxxxx> wrote:
>> 
>>> Hi, Keir,
>>> 
>>> In recent effort on debugging cpu offline/online, I met Xen panic some
>>> times.
>>> 
>>> The reason of the panic is caused by following code path:
>>> 
>>> xmalloc ---> alloc_heap_pages ---> flush_area_mask {
>>> ASSERT(local_irq_enabled)........}
>>> 
>>> This bring me the question: is it safe to call xmalloc with local irq
>>> disabled? As you can see, not all alloc_heap_pages will result in TLB
>>> flushing. But once it calls, the assertion will fail.
>>> 
>>> In my case, the xmalloc is called with starting secondary processors. Some
>>> initialization code run with local irq enabled, for example, the MCA
>>> initialization. Normally this piece of code runs when all heap pages do not
>>> have a former owner (no domain is initialized at booting time, I guess), so
>>> calling xmalloc won't be a problem. But later when this same piece of code
>>> runs as a result of cpu online operation, it has possibility to trigger the
>>> assertion failure.
>>> 
>>> What's you view on this, Keir? Is it the design that xmalloc must be called
>>> with local irq enabled? I have done a hack to remove the assertion. Every
>>> things work just fine to me. But maybe I just happened not to run into any
>>> problem with the hack.
>>> 
>>> Shan Haitao
>>> 
>> 
>> 
> 
> 



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

<Prev in Thread] Current Thread [Next in Thread>