public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Alex Zeffertt <ajz@cambridgebroadband•com>
To: Scott Wood <scottwood@freescale•com>
Cc: linuxppc-embedded@ozlabs•org
Subject: Re: local_irq_save not masking interrupts
Date: Tue, 26 Sep 2006 17:42:42 +0100	[thread overview]
Message-ID: <45195882.1090003@cambridgebroadband.com> (raw)
In-Reply-To: <451954D8.3050909@freescale.com>

Scott Wood wrote:
> Alex Zeffertt wrote:
>> I agree this indicates an intent to make it atomic, but I don't see how
>> this could cause interrupts to become re-enabled during the request_irq()
>> call.  Also, since I am calling request_irq at insmod time, i.e. in 
>> process
>> context, both GFP_ flags *should* work.
> 
> You're effectively not in process context when you disable IRQs (at 
> least, if you want them to stay that way).  By specifying GFP_KERNEL, 
> you're giving the allocator permission to go to sleep, enable IRQs, etc. 
>  The IRQ enabling will happen any time cache_grow() is called with 
> GFP_WAIT (which is part of GFP_KERNEL), assuming a growable slab.

Ah-ha!  This explains a lot...

One of the oddities I was seeing with this problem was that if I
did an "ifconfig down" on a completely unrelated net_device (a vlan)
the problem would *not* occur, i.e. I did not get an interrupt
during the critical section.  Now I understand why:  the "ifconfig down"
command freed some memory so that the kmalloc(,GFP_KERNEL) did not
need to grow the cache.

It follows from what you are saying that kmalloc(,GFP_KERNEL)
MUST NOT occur anywhere in the call chain during a critical section.

This must catch others out too.  Surely kmalloc/cache_grow should
return NULL rather than enable interrupts.  In fact, shouldn't it be
a BUG() if kmalloc(,GFP_KERNEL) is called with IRQs disabled?


Thanks for your explanation!

Alex

  reply	other threads:[~2006-09-26 16:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-26 10:00 local_irq_save not masking interrupts Alex Zeffertt
2006-09-26 10:19 ` Liu Dave-r63238
2006-09-26 10:28   ` Alex Zeffertt
2006-09-26 16:02     ` Scott Wood
2006-09-26 16:17       ` Alex Zeffertt
2006-09-26 16:27         ` Scott Wood
2006-09-26 16:42           ` Alex Zeffertt [this message]
2006-09-26 16:52             ` Scott Wood
2006-09-27 16:52 ` Esben Nielsen

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=45195882.1090003@cambridgebroadband.com \
    --to=ajz@cambridgebroadband$(echo .)com \
    --cc=linuxppc-embedded@ozlabs$(echo .)org \
    --cc=scottwood@freescale$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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