Hi Eric,
On Tue, Jul 19, 2022 at 9:26 PM Eric W. Biederman ebiederm@xmission.com wrote:
"Jason A. Donenfeld" Jason@zx2c4.com writes:
There are two deadlock scenarios that need addressing, which cause problems when the computer goes to sleep, the interface is set down, and hwrng_unregister() is called. When the deadlock is hit, sleep is delayed for tens of seconds, causing it to fail. These scenarios are:
The hwrng kthread can't be stopped while it's sleeping, because it uses msleep_interruptible() instead of schedule_timeout_interruptible(). The fix is a simple moving to the correct function. At the same time, we should cleanup a common and useless dmesg splat in the same area.
A normal user thread can't be interrupted by hwrng_unregister() while it's sleeping, because hwrng_unregister() is called from elsewhere. The solution here is to keep track of which thread is currently reading, and asleep, and signal that thread when it's time to unregister. There's a bit of book keeping required to prevent lifetime issues on current.
Is there any chance you can name the new function wake_up_task_interruptible instead of wake_up_process_interruptible.
The name wake_up_process is wrong now, it does not wake up all threads of a process. The name dates back to before linux supported multiple threads in a process, so it is grandfathered in until someone gets changes it. But please let's not have a new function with a incorrect and confusing name.
No problem. v+1 incoming.
Jason