disabling sleep when shutting down
Ian Smith
smithi at nimnet.asn.au
Sat Sep 26 18:00:04 UTC 2015
On Sat, 26 Sep 2015 00:26:31 -0700, Colin Percival wrote:
> Hi all,
>
> I think there is consensus for:
> * Using a sysctl (simpler than a device node),
> * Setting this sysctl on all architectures,
> * Calling the sysctl kern.suspend_blocked,
> * Consulting the sysctl from the ACPI code (for now) and possibly from
> other platform-specific forms of sleeping (in the indefinite future).
Sounds all good to me, FWTW.
> Points without consensus:
> * jkim thinks we should prevent suspend when we're dropping to single-user
> mode; I'm not sure I see the point, but I don't think there's any harm in
> doing that too.
We should prevent suspending _during_ shutdown to SU, of course. Once
happily in SU, is there any reason to disallow suspend? I've done it.
> * Ian Smith would like to have suspend blocked for the last 5 minutes before
> shutdown(8) signals init to shut the system down. I don't think anyone else
> has expressed a desire for this, and some people have raised concerns about
> blocking suspend for too long in case a system is running out of battery; so
> I'm inclined to leave this out at this point. (It would be easy enough to
> add the sysctl-frobbing to shutdown(8) if desired later.)
Sorry, but that rather misrepresents my position; I was trying to deal
specifically with the LID foot-shooting potential, in the case of user-
initiated shutdown, so looking at possible mechanisms. Not to worry, I
clearly didn't express myself clearly :^\
As jkim pointed out, code speaks for itself, and C is read-only here at
best .. though after 30-odd years I can usually follow it around ..
> With the above in mind, I've written (but not yet actually compiled or tested,
> so beware of typos) a patch which I think makes sense. If nobody is violently
> opposed to this I'll make sure I got the details right and then commit this in
> a few days.
+static void
+block_suspend(int block)
+{
+
+ sysctlbyname("kern.suspend_blocked", NULL, NULL, &block,
sizeof(block));
+}
This doesn't appear to get called?
Any idea if any of this may not be straightforward to MFC, to 9 maybe?
Thanks for going for the generic solution. Hope it wins that race :)
cheers, Ian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: block_suspend.patch
Type: text/x-patch
Size: 2928 bytes
Desc:
URL: <http://lists.freebsd.org/pipermail/freebsd-acpi/attachments/20150927/813f4e03/attachment.bin>
More information about the freebsd-acpi
mailing list