All of lore.kernel.org
 help / color / mirror / Atom feed
* [Question] Is it safe to call "xmalloc()" with irq disabled?
@ 2011-03-01  7:42 Haitao Shan
  2011-03-01  8:16 ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: Haitao Shan @ 2011-03-01  7:42 UTC (permalink / raw)
  To: Keir Fraser, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1161 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 1352 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-01  8:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-01  7:42 [Question] Is it safe to call "xmalloc()" with irq disabled? Haitao Shan
2011-03-01  8:16 ` Keir Fraser
2011-03-01  8:22   ` Haitao Shan
2011-03-01  8:50     ` Keir Fraser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.