views:

44

answers:

2

I am tracking down a "scheduling while atomic" error in one of our drivers, and am wondering if ioctl's are an atomic context. Also if any one has anything to share on how to get into and out of atomic contexts, and common places they occur, it would be helpful.

+5  A: 

No, ioctls generally run in process context. If a driver grabs a spinlock during the ioctl processing then the driver will enter atomic context and will remain in atomic context until it releases the spinlock.

See: http://lwn.net/Articles/274695/ for a good discussion on atomic context in Linux

Stephen Doyle
A: 

Have you turned on CONFIG_DEBUG_SPINLOCK_SLEEP, that might give you more info, including a stack trace, of where the error is.

The other angle to look at is what sleeping functions are you calling. Examples are msleep(), mutex_lock(), copy_to_user() etc.

mpe