Page MenuHomeFreeBSD

sys/power: Sleep type reporting by PM backends
ClosedPublic

Authored by obiwac on Aug 20 2025, 10:38 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 12, 6:41 AM
Unknown Object (File)
Fri, Oct 10, 9:02 PM
Unknown Object (File)
Fri, Oct 10, 8:48 PM
Unknown Object (File)
Fri, Oct 10, 8:47 PM
Unknown Object (File)
Fri, Oct 10, 8:51 AM
Unknown Object (File)
Fri, Oct 10, 8:51 AM
Unknown Object (File)
Fri, Oct 10, 8:51 AM
Unknown Object (File)
Fri, Oct 10, 8:51 AM
Subscribers

Details

Summary

Allow PM backends to report supported sleep types when registering through power_pm_register. Expose this information through kern.power.supported_stype sysctl, and set defaults for power_standby/suspend/hibernate_stype based on this.

Implement this in ACPI PM backend.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 66843
Build 63726: arc lint + arc unit

Event Timeline

Check if stype supported in power_sysctl_stype

sys/kern/subr_power.c
108–109

okay to have defensive checks like this (i mean new_stype < 0 || new_stype >= POWER_STYPE_COUNT)? or should this just be the new_stype == POWER_STYPE_UNKNOWN check?

sys/kern/subr_power.c
108–109

Given that the return type of power_name_to_stype() is an enum, it's weird to me to check for values outside of the enum. I think it's ok to assume that new_stype is valid.

145
sys/sys/power.h
96–97

To enable some extra checking.

obiwac marked 2 inline comments as done.

Fixes

markj added inline comments.
sys/kern/subr_power.c
124

In general, single-sentence sysctl descriptions should omit the period, though I can't immediately find where that's documented...

145
This revision is now accepted and ready to land.Sep 8 2025, 1:29 PM
This revision now requires review to proceed.Sep 10 2025, 11:16 AM
obiwac marked 2 inline comments as done.

forgot to actually do the small fix in question

mckusick added a subscriber: mckusick.

Looks ready to go.

This revision is now accepted and ready to land.Sep 11 2025, 5:41 AM