All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keir Fraser <keir.xen@gmail.com>
To: Haitao Shan <maillists.shan@gmail.com>, xen-devel@lists.xensource.com
Subject: Re: [Question] Is it safe to call "xmalloc()" with irq disabled?
Date: Tue, 01 Mar 2011 08:16:08 +0000	[thread overview]
Message-ID: <C9925BC8.13F3C%keir.xen@gmail.com> (raw)
In-Reply-To: <AANLkTikoC-iV5X_n-91qbVb49oFZkC0VfGYagcaLi6PK@mail.gmail.com>

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@gmail.com> 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
> 

  reply	other threads:[~2011-03-01  8:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-01  7:42 [Question] Is it safe to call "xmalloc()" with irq disabled? Haitao Shan
2011-03-01  8:16 ` Keir Fraser [this message]
2011-03-01  8:22   ` Haitao Shan
2011-03-01  8:50     ` Keir Fraser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C9925BC8.13F3C%keir.xen@gmail.com \
    --to=keir.xen@gmail.com \
    --cc=maillists.shan@gmail.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.