tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pmf(9) vs sysmon for power events (especially sleep when powerd(8) is not running)



Dear all,

i am experiencing some difficulties regarding the somewhat duplicity
of functionality provided by sysmon_*(9) and pmf(9) APIs, for everything
that has to deal with power management event.

Disclaimer: this is for suspend/save events, whatever you name them; each
implementation has its own way of specifying them: Xen domU assume
that sleep/suspension is a serialization of VM memory state to a disk file, while ACPI have different expectations depending on level (suspend to RAM,
suspend to disk, states, etc.)

Back in december, Jukka removed the sysctl node in machdep.sleep_state and pushed its functionality under ``hw.acpi''. This is all good, but NetBSD is still missing some kind of abstraction to cope with the various "power backends" that can manage sleep events. This covers more than just ACPI and
Xen though (embedded devices come to mind).

Currently, we have two frameworks: pmf(9) and the different sysmon_(9)
routines. As I see them, pmf(9) is fairly lower level, and covers only device
attach/detach/suspension (and inter driver signaling). sysmon_*(9) are
"userlevel" oriented, and certain events can even be managed by userland through powerd(8) (please confirme about these goals/non goals). Except for specific situation, "high level events" (LID open/close, power button press)
are first handled via sysmon, then injected to drivers via pmf.

Jukka and Paul proposed that I look at an API [1] for backend registration. While this is supposedly the way to go, I would like to know what would be its real use. Currently, shutdown/reboot events are managed by cpu_reboot(9),
and pushing some kind of ``RB_SUSPEND'' to it feels awkward. Would
the "sysmon_power" backends be a long term replacement for the various
shutdown/reboot/sleep/power control (power-on scheduling, sleep states) hooks, or should it be just regarded as the registration of a sleep handler, and
nothing more?

I am also having a hard time figuring out the different between the goals of sysmon_pswitch_register(9) and pmf_device_register(9). Both are supposed to handle power events, but sysmon_pswitch_register(9) is now a NO-OP, with
everything directly injected into pmf(9).

BTW, would the handler be supposed to be called only when powerd(8) is running (with the sleep_button script execing zzz(8)), or could it be used when it is not, including situation where there's no real thread context (on interrupts)?

Thanks

[1] http://nxr.netbsd.org/source/xref/src/sys/dev/sysmon/sysmon_power.c#743

--
Jean-Yves Migeon
jeanyves.migeon%free.fr@localhost


Home | Main Index | Thread Index | Old Index