When the Linux kernel prints "bug: Scheduling while atomic" and "Bad: scheduling from the idle thread" errors, it usually calls sleep functions in the interrupt processing function, such as semaphore, mutex, sleep, and other sleep functions, while the Linux kernel requires that the system height and preemption are not allowed during Interrupt Processing, and other tasks can be performed only after the interrupt processing is completed. Therefore, it must not be too long to fully consider the interrupt processing time.
Another problem that can be solved is that something should not be done in the idle process. Now Linux is used for many handheld devices. To reduce power consumption, the general practice is to reduce the frequency of CPU or RAM in the idle process, disable some devices, and so on. To ensure the atomicity of these actions, ensure that "bad: scheduling from the idle thread "errors!
Keywords:
Synchronization Methods in Linux kernel interrupt handler Functions
"Bug: Scheduling while atomic" Error Analysis
"Bad: scheduling from the idle thread" Error Analysis