public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Yinghai Lu <yinghai@kernel.org>, Ingo Molnar <mingo@elte.hu>,
	the arch/x86 maintainers <x86@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Can request_irq be called under spinlock?
Date: Fri, 13 Feb 2009 04:38:04 +0100	[thread overview]
Message-ID: <20090213033803.GA13631@cmpxchg.org> (raw)
In-Reply-To: <4994B23D.4040806@goop.org>

On Thu, Feb 12, 2009 at 03:35:25PM -0800, Jeremy Fitzhardinge wrote:
> Thomas Gleixner wrote:
> >I dont think that proc_mkdir conventions have changed
> >recently. According to git blame fs/proc/generic.c:
> >
> >^1da177e (Linus Torvalds     2005-04-16 15:20:36 -0700 580)     ent = 
> >kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
> >
> >  
> 
> I think its new that request_irq ends up calling proc_mkdir though.  But 
> its moot now anyway; I cleaned up that code, and don't call request_irq 
> under spinlock any more.

Still, the attached could be of use, no?

	Hannes

---
From: Johannes Weiner <hannes@cmpxchg.org>
Subject: irq: use GFP_KERNEL for action allocation in request_irq()

request_irq() calls into proc code via __setup_irq() which is not safe
in an atomic context, so request_irq() can itself use the more
reliable GFP_KERNEL allocation for the action descriptor.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 291f036..0f2b3b6 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -709,7 +709,7 @@ int request_irq(unsigned int irq, irq_handler_t handler,
 	if (!handler)
 		return -EINVAL;
 
-	action = kmalloc(sizeof(struct irqaction), GFP_ATOMIC);
+	action = kmalloc(sizeof(struct irqaction), GFP_KERNEL);
 	if (!action)
 		return -ENOMEM;
 

  reply	other threads:[~2009-02-13  3:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12 20:08 Can request_irq be called under spinlock? Jeremy Fitzhardinge
2009-02-12 22:28 ` Thomas Gleixner
2009-02-12 23:35   ` Jeremy Fitzhardinge
2009-02-13  3:38     ` Johannes Weiner [this message]
2009-02-13  9:52       ` Ingo Molnar
2009-02-13  9:23     ` Thomas Gleixner

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=20090213033803.GA13631@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yinghai@kernel.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