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/
Home Products Support Community News


[Xen-devel] Re: [Question] Is it safe to call "xmalloc()" with irq disab

To: Haitao Shan <maillists.shan@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
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:16:08 +0000
Delivery-date: Tue, 01 Mar 2011 00:16:48 -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:message-id :thread-topic:thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; bh=kTz1SporOSkXJT8zgR3+xIcEfAUY6vgEGS+Q8r+mcgg=; b=s7kVbT1Mn75SgKrH4lzAbSnsZUfYujxHdJ8IC+pBFGrSJxkHIhG9ma8G5uUVXpQcYm 01TaX/XgNn3UQAvLfTKwPD0f073YzYh5IJaaTby4qBP9EcBX/zJZ92bH5c1LwL7/xYqf c46UFhF6dJw0nemQZ03X04iMdDOR+eoDBPe3o=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=user-agent:date:subject:from:to:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; b=rsNrWAHKjyuTpms0KtSmyAoBObPbh00PNGjpxSq3QthjqKZjc7UjqhOZ+rjjbivG3g /1NnLsIDy+D1twJUfxsBNbpGk+qaliFnKVHLYMPd961YPoU1CVK5EKOZnR/PC++uvYmh tRNjl2dFoZbmvckVxQQoUkmBdqrWvx9Aa6a2Y=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <AANLkTikoC-iV5X_n-91qbVb49oFZkC0VfGYagcaLi6PK@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: AcvX6OqwmtM6/EzOHkKEysYVx+tJ2g==
Thread-topic: [Question] Is it safe to call "xmalloc()" with irq disabled?
User-agent: Microsoft-Entourage/

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

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