kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: arvid.brodin@enea.com (Arvid Brodin)
To: kernelnewbies@lists.kernelnewbies.org
Subject: inconsistent lock state on call to kmem_cache_zalloc()
Date: Thu, 17 Mar 2011 23:49:55 +0100	[thread overview]
Message-ID: <4D829013.2050205@enea.com> (raw)
In-Reply-To: <AANLkTi=qP7JjWdGEtDWfoxnDoKQHEELN+Xw0ZnABG+e6@mail.gmail.com>

Daniel Baluta wrote:
> On Thu, Mar 17, 2011 at 10:59 PM, Arvid Brodin <arvid.brodin@enea.com> wrote:
>> Hi,
>>
>> Daniel Baluta wrote:
>>> Hello,
>>>
>>>> The call to kmem_cache_zalloc() never returns; the printk() text on the line
>>>> after is never displayed and the system locks up. The printk() om the line
>>>> before displays.
>>> What flags are you passing to kmem_cache_zalloc?
>> I'm using the flags passed to the urb_enqueue() function; a printk reveals
>> the value is 16, which would be GFP_NOIO if I read include/linux/gfp.h correctly.
> 
> Hmm, I guess this is not quite OK. You hold a spinlock, and you can sleep
> while allocating memory.

I can see why this is not a good idea, and indeed using GFP_ATOMIC gets rid of the

=================================
[ INFO: inconsistent lock state ]
2.6.37 #116
---------------------------------
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
...

message. Many thanks!

To the list in general:

Still, I would have expected some kind of "You're sleeping while holding a
spinlock / with interrupts disabled!" message (I have DEBUG_SPINLOCK_SLEEP
enabled), not a message from the lock debug code. Well... perhaps one of the
'W's in the message stands for "wait"? Also, the call stack in my original
mail shows the interrupt routine being called despite having disabled
interrupts - are they automatically enabled by functions that sleep?

> 
> Daniel.

-- 
Arvid Brodin
Enea Services Stockholm AB

      reply	other threads:[~2011-03-17 22:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-17 18:13 inconsistent lock state on call to kmem_cache_zalloc() Arvid Brodin
2011-03-17 19:26 ` Daniel Baluta
2011-03-17 20:59   ` Arvid Brodin
2011-03-17 21:46     ` Daniel Baluta
2011-03-17 22:49       ` Arvid Brodin [this message]

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=4D829013.2050205@enea.com \
    --to=arvid.brodin@enea.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).