From owner-freebsd-acpi@freebsd.org Thu Sep 17 03:51:06 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 4F8669CEEFD for ; Thu, 17 Sep 2015 03:51:06 +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 CCE311189 for ; Thu, 17 Sep 2015 03:51:05 +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=to:from:subject:mime-version:content-type:content-transfer-encoding; s=smtpapi; bh=CKhzfl3S/FD2SlE6LAObWw2JjR8=; b=Z+unFzIsdqz5e3AjKT L5bl60CIXsno3rADtP5e4QGCoBMpjSsMb3PvYsqgWWQ0oBv2Y6bPv543W6cT8H3i M7vid2abRJN6wkaAquGU7oIRiIs2Ki7fHLPemJtu1tiwFXoLC9wSNHe5vAUKKh3S qhecd8CBsL3/KBMaPgzw+Hc4Q= Received: by filter-389.sjc1.sendgrid.net with SMTP id filter-389.26777.55FA38A633 2015-09-17 03:51:02.870555405 +0000 UTC Received: from mail.tarsnap.com (ec2-54-86-246-204.compute-1.amazonaws.com [54.86.246.204]) by ismtpd0002p1iad1.sendgrid.net (SG) with ESMTP id QBwifaJTRui0rrCSlkxS4w for ; Thu, 17 Sep 2015 03:51:02.591 +0000 (UTC) Received: (qmail 4116 invoked from network); 17 Sep 2015 03:51:00 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by ec2-107-20-205-189.compute-1.amazonaws.com with ESMTP; 17 Sep 2015 03:51:00 -0000 Received: (qmail 44691 invoked from network); 17 Sep 2015 03:49:28 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by clamshell.daemonology.net with SMTP; 17 Sep 2015 03:49:28 -0000 To: "freebsd-acpi@freebsd.org" From: Colin Percival Subject: disabling sleep when shutting down X-Enigmail-Draft-Status: N1110 Message-ID: <55FA3848.7090802@freebsd.org> Date: Wed, 16 Sep 2015 20:49:28 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SG-EID: t2fXfoZHCw6vGsGKHqKxJ9qWwHSlQfPdDS+3+p6rOCsbdiZynaa9pClUWubtrrDzYvA0YDVgBdXe/9 ub4NcbnY6K0onlwFovhH/U823ZXAsS3BbOdzAJVpDzDKipKLDCWywOwu9OmsCmLx9b9WifBE0ulCPn fVtwkYJfUF5OFmY= 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: Thu, 17 Sep 2015 03:51:06 -0000 Hi ACPI people, I ran into an interesting glitch recently: I told my laptop to shut down, then closed the lid... and it promptly went into S3. When I opened the lid a couple days later, it resumed... and then finished the shutdown which it had started 2 days earlier. Meanwhile with two days of sitting in S3 instead of S5, the battery had almost completely drained. The obvious answer here is to disable Suspend if we're in the shutdown path. My first thought was to make rc.suspend slightly smarter, but that isn't good enough since there's a 10 second timeout after which the suspend will happen even if rc.suspend doesn't send the expected acknowledgment. So I think we need to get the kernel ACPI bits to disable Suspend. It looks to me like adding a sysctl to dev/acpica/acpi.c and checking it in acpi_ReqSleepState would work; then we just need a line in /etc/rc.shutdown to set the sysctl. But ACPI code scares me, so I figured I should check with you guys first... am I missing anything? -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid