2.6.12-rc2 in_atomic() picks up preempt_disable()
2.6.12-rc2, with CONFIG_PREEMPT and CONFIG_PREEMPT_DEBUG. The in_atomic() macro thinks that preempt_disable() indicates an atomic region so calls to __might_sleep() result in a stack trace. preempt_count() returns 1, no soft or hard irqs are running and no spinlocks are held. It looks like there is no way to distinguish between the use of preempt_disable() in the lock functions (atomic) and preempt_disable() outside the lock functions (do nothing that might migrate me).
Quoted 3 lines · Keith Owens
2.6.12-rc2, with
CONFIG_PREEMPTandCONFIG_PREEMPT_DEBUG. Thein_atomic()macro thinks thatpreempt_disable()indicates an atomic region so calls to__might_sleep()result in a stack trace.
but you're not allowed to schedule when preempt is disabled!
Quoted 5 lines
preempt_count()returns 1, no soft or hard irqs are running and no spinlocks are held. It looks like there is no way to distinguish between the use ofpreempt_disable()in the lock functions (atomic) andpreempt_disable()outside the lock functions (do nothing that might migrate me).
in what code are you seeing this?
Quoted 7 lines · Arjan van de Ven
Quoted 3 lines · Keith Owens
2.6.12-rc2, with
CONFIG_PREEMPTandCONFIG_PREEMPT_DEBUG. Thein_atomic()macro thinks thatpreempt_disable()indicates an atomic region so calls to__might_sleep()result in a stack trace.but you're not allowed to schedule when preempt is disabled!
Could it be related to this:
http://marc.theaimsgroup.com/?l=linux-kernel&m=111277325629959&w=2
Signature · 2 lines
Romano Giannetti - Univ. Pontificia Comillas (Madrid, Spain) Electronic Engineer - phone +34 915 422 800 ext 2416 fax +34 915 596 569
Quoted 9 lines · Keith Owens
2.6.12-rc2, with
CONFIG_PREEMPTandCONFIG_PREEMPT_DEBUG. Thein_atomic()macro thinks thatpreempt_disable()indicates an atomic region so calls to__might_sleep()result in a stack trace.preempt_count()returns 1, no soft or hard irqs are running and no spinlocks are held. It looks like there is no way to distinguish between the use ofpreempt_disable()in the lock functions (atomic) andpreempt_disable()outside the lock functions (do nothing that might migrate me).
Is this new behaviour?
It sounds correct to me:
preempt_disable(); do_something_which_might_sleep(); preempt_enable();
Is buggy?
Quoted 8 lines · Keith Owens
2.6.12-rc2, with
CONFIG_PREEMPTandCONFIG_PREEMPT_DEBUG. Thein_atomic()macro thinks thatpreempt_disable()indicates an atomic region so calls to__might_sleep()result in a stack trace.preempt_count()returns 1, no soft or hard irqs are running and no spinlocks are held. It looks like there is no way to distinguish between the use ofpreempt_disable()in the lock functions (atomic) andpreempt_disable()outside the lock functions (do nothing that might migrate me).
preempt_disable() sections are just as much atomic as spinlocked regions. Like the name suggests it.
Ingo