Skip to contentSkip to conversation

in_atomic doesn't count local_irq_disable?

DISCUSSION Srivatsa Vaddagiri 2 participants 3 messages Dec 29, 2003 – Dec 30, 2003

lore
Share & tools
lore
#0 lore raw

Hi,
I am getting messages like:

"Debug: sleeping function called from invalid context at include/linux/rwsem.h:45" "in_atomic: 0, irqs_disabled(): 1"

while running some (CPU Hotplug) tests against (2.6.0-test11-bk6 + the CPU hotplug patch).

This is basically because down_read was called with interrupts disabled .. __might_sleep was "unable" to dump the stack of callers which lead to this problem ..

I put some debug code in down_read (an inline function) and found that down_read was actually called from do_page_fault.

do_page_fault avoids calling this down_read if we are "in_atomic()" Isn't in_atomic supposed to count IRQs disabled case? If not then shouldn't do_page_fault also check for irqs_disabled() before calling down_read()?

Please let me know what I am missing here!

Signature · 5 lines
Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560033
#1 lore raw

FYI, I am running with preemption disabled ..

Quoted 31 lines · Srivatsa Vaddagiri

Hi,
I am getting messages like:

"Debug: sleeping function called from invalid context at include/linux/rwsem.h:45" "in_atomic: 0, irqs_disabled(): 1"

while running some (CPU Hotplug) tests against (2.6.0-test11-bk6 + the CPU hotplug patch).

This is basically because down_read was called with interrupts disabled .. __might_sleep was "unable" to dump the stack of callers which lead to this problem ..

I put some debug code in down_read (an inline function) and found that down_read was actually called from do_page_fault.

do_page_fault avoids calling this down_read if we are "in_atomic()" Isn't in_atomic supposed to count IRQs disabled case? If not then shouldn't do_page_fault also check for irqs_disabled() before calling down_read()?

Please let me know what I am missing here!

Signature · 5 lines
Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560033
Signature · 5 lines
Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560033
#2 lore raw
In reply to Srivatsa Vaddagiri
Quoted 4 lines · On Mon, 29 Dec 2003 19:03:36 +0530 Srivatsa Vaddagiri <[email protected]> wrote:

do_page_fault avoids calling this down_read if we are "in_atomic()" Isn't in_atomic supposed to count IRQs disabled case? If not then shouldn't do_page_fault also check for irqs_disabled() before calling down_read()?

in_atomic() doesn't actually return true if irqs are disabled.

hence "(in_atomic() || irqs_disabled())" in __might_sleep.

do_page_fault should have the same test...

Thanks,
Rusty.

Signature · 2 lines
   there are those who do and those who hang on and you don't see too
   many doers quoting their contemporaries.  -- Larry McVoy