From owner-freebsd-acpi@freebsd.org Tue Sep 22 08:26:38 2015 Return-Path: Delivered-To: freebsd-acpi@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E8EDA037F7 for ; Tue, 22 Sep 2015 08:26:38 +0000 (UTC) (envelope-from bounces+73574-3fe6-freebsd-acpi=freebsd.org@sendgrid.net) Received: from o3.shared.sendgrid.net (o3.shared.sendgrid.net [208.117.48.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A2B85113F for ; Tue, 22 Sep 2015 08:26:37 +0000 (UTC) (envelope-from bounces+73574-3fe6-freebsd-acpi=freebsd.org@sendgrid.net) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info; h=subject:to:references:cc:from:mime-version:in-reply-to:content-type:content-transfer-encoding; s=smtpapi; bh=IrDGZ6NmP8smITU/eS+PTBRrtRI=; b=bFggMClbH3NDEzM9nh i4fBt/hoDESz8cVomRw4AazsAE0EgiuZumB9ld0O4Pp/Fa3IVGt/UhXt01NnZ9IO Gmnzt/u2haQxdabffOjb58BhG2IU92W+RfoOlpoC2L0R3uqUBR2uHNrUZTvGZewK Y0Q4ayPwYoCORj3p6N3EgyZ0M= Received: by filter0423p1mdw1.sendgrid.net with SMTP id filter0423p1mdw1.24274.560110B528 2015-09-22 08:26:29.502083787 +0000 UTC Received: from mail.tarsnap.com (ec2-54-86-246-204.compute-1.amazonaws.com [54.86.246.204]) by ismtpd0003p1iad1.sendgrid.net (SG) with ESMTP id FPYAbwvTRMGfQVIBAP98Jw for ; Tue, 22 Sep 2015 08:26:29.337 +0000 (UTC) Received: (qmail 81452 invoked from network); 22 Sep 2015 08:26:21 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by ec2-107-20-205-189.compute-1.amazonaws.com with ESMTP; 22 Sep 2015 08:26:21 -0000 Received: (qmail 5792 invoked from network); 22 Sep 2015 08:26:27 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by clamshell.daemonology.net with SMTP; 22 Sep 2015 08:26:27 -0000 Subject: Re: disabling sleep when shutting down To: Ian Smith References: <55FA3848.7090802@freebsd.org> <55FB233D.2080000@FreeBSD.org> <55FB48E3.20401@freebsd.org> <55FC4F13.3090603@FreeBSD.org> <55FC57F9.3050702@yahoo.com> <55FE5D54.1030806@freebsd.org> <20150920194946.U29510@sola.nimnet.asn.au> Cc: Anthony Jenkins , Jung-uk Kim , "freebsd-acpi@freebsd.org" From: Colin Percival X-Enigmail-Draft-Status: N1110 Message-ID: <560110B3.6050401@freebsd.org> Date: Tue, 22 Sep 2015 01:26:27 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20150920194946.U29510@sola.nimnet.asn.au> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SG-EID: t2fXfoZHCw6vGsGKHqKxJ9qWwHSlQfPdDS+3+p6rOCvdSZrvh00wPTOBy8w92olYQHZKw4H458c7fK 8yTLbZhYuBUUk3cDI7Fvf2ryKqWA552xxkwogQvyMqVKpm8DMtCIASCIkgGcYtTcfFBIdq/XWyK3Ef jcRt/GC5Opo6913ZW2Uo4Afpd+AsdVSTiCRK X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Sep 2015 08:26:38 -0000 On 09/20/15 03:04, Ian Smith wrote: > On Sun, 20 Sep 2015 00:16:36 -0700, Colin Percival wrote: > > On 09/18/15 11:29, Anthony Jenkins wrote: > > > Is it possible for /etc/rc.shutdown to complete, but shutdown not > > > occur? If so, there should be a mechanism to restore the ability to > > > suspend. Other than that, I like it. > > > > Hmm... well, rc.shutdown runs before the system drops into single-user > > mode. Which makes me think that maybe we should be making the kernel > > call from inside init instead of from rc.shutdown. > > I still think disabling suspend from shutdown.c, at the same time as > creating /var/run/nologin might be the best way to go, to avoid any > possibility of untimely suspending once committed to shutting down. So you think we should disable suspend for the last 5 minutes before a scheduled shutdown? This seems a bit strange to me... and I honestly can't imagine a situation where you'd need to announce an imminent shutdown of your laptop to logged-in users. > For one thing, shutdown's -o flag bypasses using init and calls halt or > reboot directly, though I don't know if anyone uses that. Right, I figured it wasn't worth worrying about that case since anyone who uses that hopefully knows what they're doing; also since that skips running rc.shutdown there's a much smaller race window. On the other hand, "send a signal to init" and the sysv compatible approach of running `init [runlevel]` are likely to be used by other tools (e.g., desktop environments), so I don't think we should assume that reboot/poweroff requests always go through shutdown(8). > For another, > if shutdown fails for any reason, or is cancelled by signal by the user > .. or in any case, I gather .. finish() removes /var/run/nologin, and > could also there reenable suspend, covering Anthony's point. This would also be accomplished by having the suspend-disabling done by init; if you tell shutdown(8) to not shut the system down, then it never sends the relevant signal to init. The shutdown(8) utility doesn't do any shutting down itself; it's just a front-end which makes an announcement, sets a timer, and disables logins, and then ultimately asks init(8) to do the real work (including spawning rc.shutdown). -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid