tech-kern archive

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

sysmon_pswitch_event(): provide a sleep routine when powerd(8) is not running



Dear list,

I would like to merge my xensuspend branch ASAP before -6 gets branched, and I need to fix an issue I have with the current suspend code as used via xenbus_shutdown_handler() [1].

The current code used to manage power events [2] is currently limited by the fact that, for SLEEP events, when powerd(8) is not running, the event is absorbed and not handled further (that's perhaps the reason of the existence of the /* XXX */ comment). As sysmon_pswitch_event() cannot return an error code, the caller cannot handle it properly.

This introduces a small problem with Xen suspend code: when you put a domain to sleep from dom0 (assuming you did not launch powerd in the domU), xend will mark the domain as "suspending/migrating", and block subsequent xm commands. The only way to resolve the freeze is to log in domU via console, and manually suspend it (a task typically performed by powerd(8)). Rather uneasy.

For this reason, I would like to either:
1 - modify sysmon_pswitch_event prototype so it can return an error (therefore leaving the possibility for the caller to fix the event by itself), OR 2 - add a MD system_suspend() routine, define it to NULL by default, and which can be overriden by MD should there be a need to call the suspend code without going through powerd(8) via sysmon_pswitch_event(), OR 3 - alternatively, add a RB_SLEEP flags to cpu_reboot(), which will basically do the same as the above, except that we could reuse part of the cpu_reboot function.

IMHO, 1) breaks power management event abstraction, and 3) seems to extend cpu_reboot() beyond its original goal (except if you consider that "sleep" is a special case of system "halt").

Opinions, please. If no-one raises concern, I will either go for 2) or 3) :)

[1] http://nxr.netbsd.org/xref/src/sys/arch/xen/xen/shutdown_xenbus.c#82 [2] http://nxr.netbsd.org/source/xref/src/sys/dev/sysmon/sysmon_power.c#sysmon_pswitch_event

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


Home | Main Index | Thread Index | Old Index