Kernel Newbies archive on lore.kernel.org
 help / color / Atom feed
* suspend mode
@ 2019-10-05 10:54 nunojsa
  0 siblings, 0 replies; only message in thread
From: nunojsa @ 2019-10-05 10:54 UTC (permalink / raw)
  To: kernelnewbies

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á

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-05 10:54 suspend mode nunojsa

Kernel Newbies archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org kernelnewbies@archiver.kernel.org
	public-inbox-index kernelnewbies

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/ public-inbox