Skip to contentSkip to conversation

Sleeping in interrupt context

PATCH New Matthew Wilcox 1 participant 1 message Sep 6, 2002 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Sleeping in interrupt context

We're using GFP_KERNEL where we should be using GFP_ATOMIC in acpi_bus_generate_event(). Here's a route to it:
Find an ACPI button:

acpi_button_add

|-> acpi_install_fixed_event_handler(acpi_button_notify);
    |-> acpi_gbl_fixed_event_handlers[event].handler =

acpi_button_notify

Get an interrupt:

acpi_ev_sci_handler
|-> acpi_ev_fixed_event_detect

    |-> acpi_ev_fixed_event_dispatch
        |-> acpi_gbl_fixed_event_handlers[event].handler
            |-> acpi_button_notify
                |-> acpi_bus_generate_event
                    |-> kmalloc(sizeof(struct acpi_bus_event), GFP_KERNEL);

And we get a BUG() if that slab needs a new page. Here's a patch:

Index: drivers/acpi/bus.c
===================================================================
RCS file: /var/cvs/linux/drivers/acpi/bus.c,v
retrieving revision 1.3

acpi/bus.c +1 -1
diff -u -p -r1.3 bus.c
@@ -660,7 +660,7 @@ acpi_bus_generate_event (
 	if (!event_is_open)
 		return_VALUE(0);
 
-	event = kmalloc(sizeof(struct acpi_bus_event), GFP_KERNEL);
+	event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC);
 	if (!event)
 		return_VALUE(-ENOMEM);
 
Signature · 11 lines
Due to broken mail software, I lost 100 email messages between Aug 13 and
Aug 19.  If yours was one of them, please resend.

It's always legal to use Linux (TM) systems
http://www.gnu.org/philosophy/why-free.html


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390