suspend mode

nunojsa noname.nuno at gmail.com
Sat Oct 5 06:54:14 EDT 2019


Hi all,

I have a HWMON driver which is using simple pm options. So, I have a suspend() and resume() where I try
to lock a mutex before suspending/resuming. This mutex is shared with the read/write path of the
hwmon attributes. I also have a flag which is set when suspend() is done so that, if someone tries to
read some attribute, will get an error since doing a read/write on the device bus will wake it up. Im
starting to think that this does not make any sense. Is there any way that a userland process runs during
suspend? As I understand, all tasks should be frozen before starting to suspend the HW devices. Is this right?
Furthermore, now that I think about this, trying to lock the mutex on the PM callbacks seems dangerous
since it can lead to deadlock (if some frozen task is helding the lock?). However, I definitely saw drivers
trying to lock shared mutexes in the PM callbacks. Aren't these callbacks atomic? Is there any scenario where
it makes to sense to care about concurrency in these functions?


Thanks for the help!
- Nuno Sá



More information about the Kernelnewbies mailing list