Are ioctl driver functions made out of atomic context in Linux 2.6?

I am tracking the "scheduling while atomic" error in one of our drivers, and I am wondering if ioctl is an atomic context. In addition, if someone has something that could be told about how to get into and out of the atomic context, as well as about the common places that they met, it would be useful.

+3
source share
2 answers

No, ioctls usually run in the context of a process. If during ioctl processing the driver captures a spin lock, the driver will enter the atomic context and remain in the atomic context until it releases the spin lock.

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

+8
source

Is it included CONFIG_DEBUG_SPINLOCK_SLEEP, which can give you more information, including a stack trace, where the error is.

Another angle you need to look at is the sleep functions that you invoke. Examples are msleep(), mutex_lock(), copy_to_user()etc.

+2
source

Source: https://habr.com/ru/post/1762898/


All Articles