linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How should userland app be notified when kernel comes out of suspend or hibernation?
@ 2025-02-14 23:09 Dale Mellor
  2025-06-01 16:54 ` Ping: " Dale Mellor
  0 siblings, 1 reply; 3+ messages in thread
From: Dale Mellor @ 2025-02-14 23:09 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: Type: text/plain, Size: 816 bytes --]

I am the originator of the GNU mcron app, which waits (using select)
for set amounts of time before executing some function on behalf of the
user.  But when the system comes out of sleep the timings are all wrong
and need to be re-evaluated.  But how does my application know when
this needs to happen?

I'm currently trying to use the ACPI netlink interface, which
conveniently gives me a socket I can add to the select call and wakes
me up when some power-changing event occurs.  However, there is not an
event specifically for notifying the coming out of sleep, and different
systems will have different hardware which reacts in this situation
(the netlink interface has a soft specification and requires
introspection to understand the data it delivers).

What is the 'official' way to do this?


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Ping: How should userland app be notified when kernel comes out of suspend or hibernation?
  2025-02-14 23:09 How should userland app be notified when kernel comes out of suspend or hibernation? Dale Mellor
@ 2025-06-01 16:54 ` Dale Mellor
  2025-07-24  4:09   ` Russell Haley
  0 siblings, 1 reply; 3+ messages in thread
From: Dale Mellor @ 2025-06-01 16:54 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: Type: text/plain, Size: 974 bytes --]

Just bouncing this back up.  Is anybody able to give any advice? 
Thanks in advance.

-------- Forwarded Message --------
Date: 02/14/25 23:09:34

I am the originator of the GNU mcron app, which waits (using select)
for set amounts of time before executing some function on behalf of the
user.  But when the system comes out of sleep the timings are all wrong
and need to be re-evaluated.  But how does my application know when
this needs to happen?

I'm currently trying to use the ACPI netlink interface, which
conveniently gives me a socket I can add to the select call and wakes
me up when some power-changing event occurs.  However, there is not an
event specifically for notifying the coming out of sleep, and different
systems will have different hardware which reacts in this situation
(the netlink interface has a soft specification and requires
introspection to understand the data it delivers).

What is the 'official' way to do this?



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Ping: How should userland app be notified when kernel comes out of suspend or hibernation?
  2025-06-01 16:54 ` Ping: " Dale Mellor
@ 2025-07-24  4:09   ` Russell Haley
  0 siblings, 0 replies; 3+ messages in thread
From: Russell Haley @ 2025-07-24  4:09 UTC (permalink / raw)
  To: mcron-lsfnyl, linux-pm

On 6/1/25 11:54 AM, Dale Mellor wrote:
> Just bouncing this back up.  Is anybody able to give any advice? 
> Thanks in advance.

TFD_TIMER_CANCEL_ON_SET flag, perhaps?

Maybe for belt-and-suspenders, check wallclock time before taking any
action. I think a descehdule/suspend/resume can happen between any two
CPU instructions though, so I don't think there's any way to save you
from the ToC/ToU problem.

Good luck,

Russell

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-24  4:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-14 23:09 How should userland app be notified when kernel comes out of suspend or hibernation? Dale Mellor
2025-06-01 16:54 ` Ping: " Dale Mellor
2025-07-24  4:09   ` Russell Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).