linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* inappropriate use of in_atomic()
@ 2005-03-11  4:40 Andrew Morton
  2005-03-11  6:25 ` Stephen Rothwell
       [not found] ` <20050310204006.48286d17.akpm-3NddpPZAyC0@public.gmane.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Andrew Morton @ 2005-03-11  4:40 UTC (permalink / raw)
  To: Paul Mackerras, Jean Tourrilhes, javier, linux-fbdev-devel,
	acpi-devel, linux1394-devel, Roland Dreier
  Cc: linux-kernel


in_atomic() is not a reliable indication of whether it is currently safe
to call schedule().

This is because the lockdepth beancounting which in_atomic() uses is only
accumulated if CONFIG_PREEMPT=y.  in_atomic() will return false inside
spinlocks if CONFIG_PREEMPT=n.

Consequently the use of in_atomic() in the below files is probably
deadlocky if CONFIG_PREEMPT=n:

	arch/ppc64/kernel/viopath.c
	drivers/net/irda/sir_kthread.c
	drivers/net/wireless/airo.c
	drivers/video/amba-clcd.c
	drivers/acpi/osl.c
	drivers/ieee1394/ieee1394_transactions.c
	drivers/infiniband/core/mad.c

Note that the same beancounting is used for the "scheduling while atomic"
warning, so if the code calls schedule with locks held, we won't get a
warning.  Both are tied to CONFIG_PREEMPT=y.

The kernel provides no reliable runtime way of detecting whether or not it
is safe to call schedule().

Can we please find ways to change the above code to not use in_atomic()? 
Then we can whack #ifndef MODULE around its definition to reduce
reoccurrences.  Will probably rename it to something more scary as well.

Thanks.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-03-12  0:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-11  4:40 inappropriate use of in_atomic() Andrew Morton
2005-03-11  6:25 ` Stephen Rothwell
     [not found] ` <20050310204006.48286d17.akpm-3NddpPZAyC0@public.gmane.org>
2005-03-11  9:11   ` Jan Kasprzak
2005-03-11  9:46     ` [ACPI] " Andrew Morton
     [not found]       ` <20050311014601.166ae43d.akpm-3NddpPZAyC0@public.gmane.org>
2005-03-11 12:26         ` [Linux-fbdev-devel] " Benjamin Herrenschmidt
2005-03-12  0:13           ` [Linux-fbdev-devel] Re: [ACPI] " Andrew Morton
2005-03-12  0:22             ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).