From owner-freebsd-acpi@FreeBSD.ORG Mon Apr 13 11:06:48 2009 Return-Path: Delivered-To: freebsd-acpi@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C3401065679 for ; Mon, 13 Apr 2009 11:06:48 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id ECE338FC23 for ; Mon, 13 Apr 2009 11:06:47 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n3DB6llP084836 for ; Mon, 13 Apr 2009 11:06:47 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n3DB6lx8084832 for freebsd-acpi@FreeBSD.org; Mon, 13 Apr 2009 11:06:47 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 13 Apr 2009 11:06:47 GMT Message-Id: <200904131106.n3DB6lx8084832@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-acpi@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-acpi@FreeBSD.org X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2009 11:06:48 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/132602 acpi [acpi] ACPI Problem with Intel SS4200: System does not o kern/130683 acpi [ACPI] shutdown hangs after syncing disks - ACPI race? o i386/129953 acpi [acpi] ACPI timeout (CDROM) with Shuttle X27D o kern/129618 acpi [acpi] Problem with ACPI on HP Pavilion DV2899 laptop o kern/129563 acpi [acpi] sleep broken on IBM/Lenovo T61 in amd64 mode o kern/128639 acpi [patch] [acpi_asus] acpi for ASUS A6F,A3E,A3F,A3N not f kern/128634 acpi [patch] fix acpi_asus(4) in asus a6f laptop o kern/127581 acpi [patch] [acpi_sony] Add support for more Sony features o kern/124744 acpi [acpi] [patch] incorrect _BST result validation for To o kern/124412 acpi [acpi] power off error on Toshiba M40 laptop o kern/123039 acpi [acpi] ACPI AML_BUFFER_LIMIT errors during boot o kern/121504 acpi [patch] Correctly set hw.acpi.osname on certain machin f kern/121454 acpi [pst] Promise SuperTrak SX6000 does not load during bo o kern/121102 acpi [acpi_fujitsu] [patch] update acpi_fujitsu for the P80 o kern/120515 acpi [acpi] [patch] acpi_alloc_wakeup_handler: can't alloc o kern/119356 acpi [acpi]: i386 ACPI wakeup not work due resource exhaust o kern/119200 acpi [acpi] Lid close switch suspends CPU for 1 second on H o kern/118973 acpi [acpi]: Kernel panic with acpi boot o kern/117605 acpi [acpi] [request] add debug.cpufreq.highest o kern/116939 acpi [acpi] PCI-to-PCI misconfigured for bus three and can o i386/114562 acpi [acpi] cardbus is dead after s3 on Thinkpad T43 with a o kern/114165 acpi [acpi] Dell C810 - ACPI problem s kern/112544 acpi [acpi] [patch] Add High Precision Event Timer Driver f o kern/108954 acpi [acpi] 'sleep(1)' sleeps >1 seconds when speedstep (Cx o kern/108695 acpi [acpi]: Fatal trap 9: general protection fault when in o kern/108488 acpi [acpi] ACPI-1304: *** Error: Method execution failed o kern/108017 acpi [acpi]: Acer Aspire 5600 o kern/106924 acpi [acpi] ACPI resume returns g_vfs_done() errors and ker o kern/105537 acpi [acpi] problems in acpi on HP Compaq nc6320 o kern/104625 acpi ACPI on ASUS A8N-32 SLI/ASUS P4P800 does not show ther o kern/102252 acpi acpi thermal does not work on Abit AW8D (intel 975) o kern/97383 acpi Volume buttons on IBM Thinkpad crash system with ACPI s i386/91748 acpi acpi problem on Acer TravelMare 4652LMi (nvidia panic, s kern/91038 acpi [panic] [ata] [acpi] 6.0-RELEASE on Fujitsu Siemens Am s kern/90243 acpi Laptop fan doesn't turn off (ACPI enabled) (Packard Be f kern/89411 acpi [acpi] acpiconf bug o i386/83018 acpi [install] Installer will not boot on Asus P4S8X BIOS 1 o kern/81000 acpi [apic] Via 8235 sound card worked great with FreeBSD 5 o i386/79081 acpi ACPI suspend/resume not working on HP nx6110 o kern/76950 acpi ACPI wrongly blacklisted on Micron ClientPro 766Xi sys s kern/73823 acpi [request] acpi / power-on by timer support o i386/72566 acpi ACPI, FreeBSD disables fan on Compaq Armada 1750 o i386/69750 acpi Boot without ACPI failed on ASUS L5 f kern/67309 acpi zzz reboot computer (ACPI S3) o kern/56024 acpi ACPI suspend drains battery while in S3 o i386/55661 acpi ACPI suspend/resume problem on ARMADA M700 o i386/54756 acpi ACPI suspend/resume problem on CF-W2 laptop 47 problems total. From owner-freebsd-acpi@FreeBSD.ORG Tue Apr 14 16:11:21 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E6A01065691 for ; Tue, 14 Apr 2009 16:11:21 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 5C41B8FC12 for ; Tue, 14 Apr 2009 16:11:18 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA17953; Tue, 14 Apr 2009 18:58:32 +0300 (EEST) (envelope-from avg@freebsd.org) Message-ID: <49E4B2A7.3020302@freebsd.org> Date: Tue, 14 Apr 2009 18:58:31 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.21 (X11/20090406) MIME-Version: 1.0 To: freebsd-acpi@freebsd.org References: <49DB639A.4090504@icyb.net.ua> <49DCF5C2.60805@root.org> <49DDF906.8090400@icyb.net.ua> <49DF3CA4.1090309@freebsd.org> In-Reply-To: <49DF3CA4.1090309@freebsd.org> X-Enigmail-Version: 0.95.7 Content-Type: multipart/mixed; boundary="------------040608080302050903060209" Cc: Subject: run resume code only for S1-S4 states X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2009 16:11:23 -0000 This is a multi-part message in MIME format. --------------040608080302050903060209 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Guys, could you please review the attached patch? Its main idea is to make control flow of acpi_EnterSleepState similar to that of acpi_ReqSleepState: reject invalid state parameter immediately and handle special S5 as early as possible. Primary purpose is to avoid running resume code when it is not necessary - e.g. shutdown_nice() typically returns immediately after initiating a graceful shutdown by sending a signal to init. As such, S5 is handled right after checking/disabling re-entry. switch becomes unneeded, because all remaining possibilities are grouped into a single case. I decided to use do-while(0) statement in the place of the switch for the following reasons: 1. minimize diff by preserving indentation 2. minimize diff by preserving control flow that depends on break statement But I am not sure how this while(0) corresponds with style(9), I couldn't find any reference in the manual page. There is also a concern about calling shutdown_nice() outside of the Giant lock and binding to CPU 0. I am not sure about the pre-requisites for this function. John, maybe you could help me here? -- Andriy Gapon --------------040608080302050903060209 Content-Type: text/plain; name="acpi_s5.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="acpi_s5.diff" ZGlmZiAtLWdpdCBhL3N5cy9kZXYvYWNwaWNhL2FjcGkuYyBiL3N5cy9kZXYvYWNwaWNhL2Fj cGkuYwppbmRleCA1MGI4NGE1Li5h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F9QQVJBTUVURVI7Ci0JYnJlYWs7Ci0gICAgfQorICAgIH0gd2hpbGUgKDApOwogCiAgICAg LyoKICAgICAgKiBCYWNrIG91dCBzdGF0ZSBhY2NvcmRpbmcgdG8gaG93IGZhciBhbG9uZyB3 ZSBnb3QgaW4gdGhlIHN1c3BlbmQKQEAgLTI2MDksOCArMjYwNCw3IEBAIGFjcGlfRW50ZXJT bGVlcFN0YXRlKHN0cnVjdCBhY3BpX3NvZnRjICpzYywgaW50IHN0YXRlKQogI2VuZGlmCiAK ICAgICAvKiBBbGxvdyBhbm90aGVyIHNsZWVwIHJlcXVlc3QgYWZ0ZXIgYSB3aGlsZS4gKi8K LSAgICBpZiAoc3RhdGUgIT0gQUNQSV9TVEFURV9TNSkKLQl0aW1lb3V0KGFjcGlfc2xlZXBf ZW5hYmxlLCBzYywgaHogKiBBQ1BJX01JTklNVU1fQVdBS0VUSU1FKTsKKyAgICB0aW1lb3V0 KGFjcGlfc2xlZXBfZW5hYmxlLCBzYywgaHogKiBBQ1BJX01JTklNVU1fQVdBS0VUSU1FKTsK IAogICAgIC8qIFJ1biAvZXRjL3JjLnJlc3VtZSBhZnRlciB3ZSBhcmUgYmFjay4gKi8KICAg ICBpZiAoZGV2Y3RsX3Byb2Nlc3NfcnVubmluZygpKQo= --------------040608080302050903060209-- From owner-freebsd-acpi@FreeBSD.ORG Tue Apr 14 18:24:15 2009 Return-Path: Delivered-To: freebsd-acpi@FreeBSD.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id D22321065701; Tue, 14 Apr 2009 18:24:14 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-acpi@FreeBSD.org Date: Tue, 14 Apr 2009 14:23:53 -0400 User-Agent: KMail/1.6.2 References: <49DB639A.4090504@icyb.net.ua> <49DF3CA4.1090309@freebsd.org> <49E4B2A7.3020302@freebsd.org> In-Reply-To: <49E4B2A7.3020302@freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200904141424.00943.jkim@FreeBSD.org> Cc: Andriy Gapon Subject: Re: run resume code only for S1-S4 states X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2009 18:24:17 -0000 On Tuesday 14 April 2009 11:58 am, Andriy Gapon wrote: > Guys, > could you please review the attached patch? > > Its main idea is to make control flow of acpi_EnterSleepState > similar to that of acpi_ReqSleepState: reject invalid state > parameter immediately and handle special S5 as early as possible. > Primary purpose is to avoid running resume code when it is not > necessary - e.g. shutdown_nice() typically returns immediately > after initiating a graceful shutdown by sending a signal to init. I tried to solve this problem once. To preserve the current behaviour, you have to clean up sc->acpi_next_sstate and set sc->acpi_sstate to S5 as well if my memory serves. > As such, S5 is handled right after checking/disabling re-entry. > switch becomes unneeded, because all remaining possibilities are > grouped into a single case. I decided to use do-while(0) statement > in the place of the switch for the following reasons: > 1. minimize diff by preserving indentation > 2. minimize diff by preserving control flow that depends on break > statement But I am not sure how this while(0) corresponds with > style(9), I couldn't find any reference in the manual page. I think goto is more cleaner and easy to read in this case. > There is also a concern about calling shutdown_nice() outside of > the Giant lock and binding to CPU 0. I am not sure about the > pre-requisites for this function. John, maybe you could help me > here? I think you don't need giant here and CPU binding is done from boot(). Jung-uk Kim From owner-freebsd-acpi@FreeBSD.ORG Wed Apr 15 08:59:49 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDF94106566B for ; Wed, 15 Apr 2009 08:59:49 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id C8B1E8FC22 for ; Wed, 15 Apr 2009 08:59:48 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id LAA09108; Wed, 15 Apr 2009 11:59:47 +0300 (EEST) (envelope-from avg@freebsd.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1] helo=edge.pp.kiev.ua) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Lu0yB-000AJE-0P; Wed, 15 Apr 2009 11:59:47 +0300 Message-ID: <49E5A200.6010306@freebsd.org> Date: Wed, 15 Apr 2009 11:59:44 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.19 (X11/20090114) MIME-Version: 1.0 To: Jung-uk Kim References: <49DB639A.4090504@icyb.net.ua> <49DF3CA4.1090309@freebsd.org> <49E4B2A7.3020302@freebsd.org> <200904141424.00943.jkim@FreeBSD.org> In-Reply-To: <200904141424.00943.jkim@FreeBSD.org> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-acpi@freebsd.org Subject: Re: run resume code only for S1-S4 states X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2009 08:59:50 -0000 on 14/04/2009 21:23 Jung-uk Kim said the following: > On Tuesday 14 April 2009 11:58 am, Andriy Gapon wrote: >> Guys, >> could you please review the attached patch? >> >> Its main idea is to make control flow of acpi_EnterSleepState >> similar to that of acpi_ReqSleepState: reject invalid state >> parameter immediately and handle special S5 as early as possible. >> Primary purpose is to avoid running resume code when it is not >> necessary - e.g. shutdown_nice() typically returns immediately >> after initiating a graceful shutdown by sending a signal to init. > > I tried to solve this problem once. To preserve the current > behaviour, you have to clean up sc->acpi_next_sstate and set > sc->acpi_sstate to S5 as well if my memory serves. I am not sure if I understand why/where this could be useful. S5 is a "terminal" state, so unless shutdown fails for some reason (can there be any?) this shouldn't matter. >> As such, S5 is handled right after checking/disabling re-entry. >> switch becomes unneeded, because all remaining possibilities are >> grouped into a single case. I decided to use do-while(0) statement >> in the place of the switch for the following reasons: >> 1. minimize diff by preserving indentation >> 2. minimize diff by preserving control flow that depends on break >> statement But I am not sure how this while(0) corresponds with >> style(9), I couldn't find any reference in the manual page. > > I think goto is more cleaner and easy to read in this case. Ok, I'll switch to that. >> There is also a concern about calling shutdown_nice() outside of >> the Giant lock and binding to CPU 0. I am not sure about the >> pre-requisites for this function. John, maybe you could help me >> here? > > I think you don't need giant here and CPU binding is done from boot(). Thank you for the review! -- Andriy Gapon From owner-freebsd-acpi@FreeBSD.ORG Wed Apr 15 16:08:11 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 0CE0C106566B; Wed, 15 Apr 2009 16:08:11 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: Andriy Gapon Date: Wed, 15 Apr 2009 12:08:02 -0400 User-Agent: KMail/1.6.2 References: <49DB639A.4090504@icyb.net.ua> <200904141424.00943.jkim@FreeBSD.org> <49E5A200.6010306@freebsd.org> In-Reply-To: <49E5A200.6010306@freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200904151208.03822.jkim@FreeBSD.org> Cc: freebsd-acpi@freebsd.org Subject: Re: run resume code only for S1-S4 states X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2009 16:08:12 -0000 On Wednesday 15 April 2009 04:59 am, Andriy Gapon wrote: > on 14/04/2009 21:23 Jung-uk Kim said the following: > > On Tuesday 14 April 2009 11:58 am, Andriy Gapon wrote: > >> Guys, > >> could you please review the attached patch? > >> > >> Its main idea is to make control flow of acpi_EnterSleepState > >> similar to that of acpi_ReqSleepState: reject invalid state > >> parameter immediately and handle special S5 as early as > >> possible. Primary purpose is to avoid running resume code when > >> it is not necessary - e.g. shutdown_nice() typically returns > >> immediately after initiating a graceful shutdown by sending a > >> signal to init. > > > > I tried to solve this problem once. To preserve the current > > behaviour, you have to clean up sc->acpi_next_sstate and set > > sc->acpi_sstate to S5 as well if my memory serves. > > I am not sure if I understand why/where this could be useful. > S5 is a "terminal" state, so unless shutdown fails for some reason > (can there be any?) this shouldn't matter. Actually, my patch was more complex, e.g., I added more code to make sure power/sleep button events get ignored and cleared when it is not in S0 state, etc. Probably I needed to track the current state because of it. I think you may ignore it for now if it is not needed anywhere else. Thanks, Jung-uk Kim From owner-freebsd-acpi@FreeBSD.ORG Wed Apr 15 16:11:32 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B313106566B; Wed, 15 Apr 2009 16:11:32 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 74F638FC08; Wed, 15 Apr 2009 16:11:31 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA21087; Wed, 15 Apr 2009 19:11:29 +0300 (EEST) (envelope-from avg@freebsd.org) Message-ID: <49E60731.8050402@freebsd.org> Date: Wed, 15 Apr 2009 19:11:29 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.21 (X11/20090406) MIME-Version: 1.0 To: Jung-uk Kim References: <49DB639A.4090504@icyb.net.ua> <200904141424.00943.jkim@FreeBSD.org> <49E5A200.6010306@freebsd.org> <200904151208.03822.jkim@FreeBSD.org> In-Reply-To: <200904151208.03822.jkim@FreeBSD.org> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-acpi@freebsd.org Subject: Re: run resume code only for S1-S4 states X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2009 16:11:32 -0000 on 15/04/2009 19:08 Jung-uk Kim said the following: > Actually, my patch was more complex, e.g., I added more code to make > sure power/sleep button events get ignored and cleared when it is not > in S0 state, etc. Probably I needed to track the current state > because of it. I think you may ignore it for now if it is not needed > anywhere else. Interesting. I think that I will go with the current patch (modulo break->goto changes), if my mentors approve. But I would like to see your patch :-) -- Andriy Gapon From owner-freebsd-acpi@FreeBSD.ORG Wed Apr 15 16:30:17 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 5F68C1065677; Wed, 15 Apr 2009 16:30:17 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: Andriy Gapon Date: Wed, 15 Apr 2009 12:30:05 -0400 User-Agent: KMail/1.6.2 References: <49DB639A.4090504@icyb.net.ua> <200904151208.03822.jkim@FreeBSD.org> <49E60731.8050402@freebsd.org> In-Reply-To: <49E60731.8050402@freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200904151230.06288.jkim@FreeBSD.org> Cc: freebsd-acpi@freebsd.org Subject: Re: run resume code only for S1-S4 states X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2009 16:30:19 -0000 On Wednesday 15 April 2009 12:11 pm, Andriy Gapon wrote: > on 15/04/2009 19:08 Jung-uk Kim said the following: > > Actually, my patch was more complex, e.g., I added more code to > > make sure power/sleep button events get ignored and cleared when > > it is not in S0 state, etc. Probably I needed to track the > > current state because of it. I think you may ignore it for now > > if it is not needed anywhere else. > > Interesting. I think that I will go with the current patch (modulo > break->goto changes), if my mentors approve. But I would like to > see your patch :-) I am not sure I still have it. It wasn't finished (thus not committed) because it was a lot more complex than I originally thought. We really have to consolidate ACPI state tracking in one variable outside of ACPI softc so that it can be atomically tracked without complex locking/unlocking layers of various locks, e.g., acpi_button from DSDT, fixed buttons from FADT, acpi, giant, etc. :-( Jung-uk Kim From owner-freebsd-acpi@FreeBSD.ORG Wed Apr 15 17:29:45 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C31ED1065761; Wed, 15 Apr 2009 17:29:45 +0000 (UTC) (envelope-from nate@root.org) Received: from nlpi053.prodigy.net (nlpi053.sbcis.sbc.com [207.115.36.82]) by mx1.freebsd.org (Postfix) with ESMTP id C04238FC25; Wed, 15 Apr 2009 17:29:44 +0000 (UTC) (envelope-from nate@root.org) Received: from [10.0.5.18] (ppp-71-139-9-173.dsl.snfc21.pacbell.net [71.139.9.173]) (authenticated bits=0) by nlpi053.prodigy.net (8.13.8 smtpauth/dk/map_regex/8.13.8) with ESMTP id n3FHTghv025874; Wed, 15 Apr 2009 12:29:43 -0500 Message-ID: <49E61986.7040709@root.org> Date: Wed, 15 Apr 2009 10:29:42 -0700 From: Nate Lawson User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Andriy Gapon References: <49DB639A.4090504@icyb.net.ua> <49DCF5C2.60805@root.org> <49DDF906.8090400@icyb.net.ua> <49DF3CA4.1090309@freebsd.org> <49E4B2A7.3020302@freebsd.org> In-Reply-To: <49E4B2A7.3020302@freebsd.org> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: freebsd-acpi@freebsd.org Subject: Re: run resume code only for S1-S4 states X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2009 17:29:46 -0000 Andriy Gapon wrote: > Guys, > could you please review the attached patch? > > Its main idea is to make control flow of acpi_EnterSleepState similar > to that of acpi_ReqSleepState: reject invalid state parameter immediately and > handle special S5 as early as possible. Primary purpose is to avoid running resume > code when it is not necessary - e.g. shutdown_nice() typically returns immediately > after initiating a graceful shutdown by sending a signal to init. > > As such, S5 is handled right after checking/disabling re-entry. > switch becomes unneeded, because all remaining possibilities are grouped > into a single case. I decided to use do-while(0) statement in the place of the > switch for the following reasons: > 1. minimize diff by preserving indentation > 2. minimize diff by preserving control flow that depends on break statement > But I am not sure how this while(0) corresponds with style(9), I couldn't find any > reference in the manual page. Overall, still looks good. I like the idea of gotos instead of the do/while(0). It's ok if the indent changes. > There is also a concern about calling shutdown_nice() outside of the Giant lock > and binding to CPU 0. I am not sure about the pre-requisites for this function. > John, maybe you could help me here? I trust jkim's opinion also. So it is probably ok to leave this way. Make sure someone with SMP tests that their system still powers off ok with this patch. Thanks, -- Nate From owner-freebsd-acpi@FreeBSD.ORG Fri Apr 17 16:31:17 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 147361065670; Fri, 17 Apr 2009 16:31:17 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id CC35A8FC18; Fri, 17 Apr 2009 16:31:15 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA15180; Fri, 17 Apr 2009 19:31:13 +0300 (EEST) (envelope-from avg@freebsd.org) Message-ID: <49E8AED0.1090008@freebsd.org> Date: Fri, 17 Apr 2009 19:31:12 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.21 (X11/20090406) MIME-Version: 1.0 To: freebsd-acpi@freebsd.org References: <49DB639A.4090504@icyb.net.ua> <49DCF5C2.60805@root.org> <49DDF906.8090400@icyb.net.ua> <49DF3CA4.1090309@freebsd.org> <49E4B2A7.3020302@freebsd.org> <49E61986.7040709@root.org> In-Reply-To: <49E61986.7040709@root.org> X-Enigmail-Version: 0.95.7 Content-Type: multipart/mixed; boundary="------------000200060802010801030105" Cc: Subject: Re: run resume code only for S1-S4 states X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2009 16:31:17 -0000 This is a multi-part message in MIME format. --------------000200060802010801030105 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit An updated version of the patch, the only difference is: do-while(0) is gone, breaks are replaces with gotos, indentation is reduced. Per Nate's request I am calling for people with SMP systems to test if powering off via power button still works with this change. It's desirable to test power off at least two times to increase a chance of non-BSP CPU being used. -- Andriy Gapon --------------000200060802010801030105 Content-Type: text/plain; name="acpi_s5.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="acpi_s5.diff" ZGlmZiAtLWdpdCBhL3N5cy9kZXYvYWNwaWNhL2Fj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IGFub3RoZXIgc2xlZXAgcmVxdWVzdCBh ZnRlciBhIHdoaWxlLiAqLwotICAgIGlmIChzdGF0ZSAhPSBBQ1BJX1NUQVRFX1M1KQotCXRp bWVvdXQoYWNwaV9zbGVlcF9lbmFibGUsIHNjLCBoeiAqIEFDUElfTUlOSU1VTV9BV0FLRVRJ TUUpOworICAgIHRpbWVvdXQoYWNwaV9zbGVlcF9lbmFibGUsIHNjLCBoeiAqIEFDUElfTUlO SU1VTV9BV0FLRVRJTUUpOwogCiAgICAgLyogUnVuIC9ldGMvcmMucmVzdW1lIGFmdGVyIHdl IGFyZSBiYWNrLiAqLwogICAgIGlmIChkZXZjdGxfcHJvY2Vzc19ydW5uaW5nKCkpCg== --------------000200060802010801030105-- From owner-freebsd-acpi@FreeBSD.ORG Fri Apr 17 18:45:07 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D815106566B for ; Fri, 17 Apr 2009 18:45:07 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [220.233.188.227]) by mx1.freebsd.org (Postfix) with ESMTP id 132A28FC12 for ; Fri, 17 Apr 2009 18:45:06 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id n3HIj0i6089310; Sat, 18 Apr 2009 04:45:01 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Sat, 18 Apr 2009 04:45:00 +1000 (EST) From: Ian Smith To: Nate Lawson In-Reply-To: <49DF7A1C.90009@root.org> Message-ID: <20090418043432.O34434@sola.nimnet.asn.au> References: <49DE1F8B.2080400@earthlink.net> <49DE2E6D.5050001@icyb.net.ua> <49DE596E.2050406@earthlink.net> <49DEFF53.1040306@icyb.net.ua> <49DF7A1C.90009@root.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: sclark46@earthlink.net, freebsd-acpi@freebsd.org, freebsd-stable@freebsd.org, Andriy Gapon Subject: Re: 6.x acpi powerbutton X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2009 18:45:07 -0000 On Fri, 10 Apr 2009, Nate Lawson wrote: > Andriy Gapon wrote: > > on 09/04/2009 23:24 Stephen Clark said the following: > >> Is there a reason it doesn't send and event like Linux that can be acted > >> upon by user space other > >> than signaling init? I like to have a message written in > >> /var/log/messages that someone pressed > >> the powerbutton. > > > > I think that for all suspend states except S5 userland is notified via > > devd mechanism and potentially can veto the suspend. S5 (soft-off) is > > coded to start shutdown immediately. You can try to hack on > > acpi_ReqSleepState in sys/dev/acpica/acpi.c. > > > > I am not sure what is the reason for this special behavior of S5. But I > > like it, because it sometimes allows me to perform semi-clean shutdown > > when X goes crazy. But I also see when it could be useful to have S5 > > request go through userland. So this could be configurable. > > The reason for userland getting into the loop in the first place was to > run programs to shut down devices and reinit them after resume. This > isn't necessary in the shutdown case because init already sends a > signal, as you mention. > > There's already a mechanism for timing out if userland is not > responding, so a suspend will ultimately happen whether or not it > answers. However, that waits for a while (1 minute?) and devd used to be > optional, so I thought it best to keep the existing S5 behavior > (immediate shutdown). > > It may be ok to enable this for S5 but I don't think it's very useful. Perhaps a silly question, but is it too late at this stage of the game to try logging S5 events to syslog before dying? I agree with Stephen, logging 'shutdown by powerbutton' surely beats what might otherwise resemble a spontaneous reboot? Or is something already logged here? cheers, Ian From owner-freebsd-acpi@FreeBSD.ORG Fri Apr 17 19:27:35 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4F44106564A; Fri, 17 Apr 2009 19:27:35 +0000 (UTC) (envelope-from nate@root.org) Received: from nlpi053.prodigy.net (nlpi053.sbcis.sbc.com [207.115.36.82]) by mx1.freebsd.org (Postfix) with ESMTP id 750A08FC15; Fri, 17 Apr 2009 19:27:35 +0000 (UTC) (envelope-from nate@root.org) Received: from [10.0.5.18] (ppp-71-139-8-80.dsl.snfc21.pacbell.net [71.139.8.80]) (authenticated bits=0) by nlpi053.prodigy.net (8.13.8 smtpauth/dk/map_regex/8.13.8) with ESMTP id n3HJRVY6031311; Fri, 17 Apr 2009 14:27:32 -0500 Message-ID: <49E8D824.1000001@root.org> Date: Fri, 17 Apr 2009 12:27:32 -0700 From: Nate Lawson User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Ian Smith References: <49DE1F8B.2080400@earthlink.net> <49DE2E6D.5050001@icyb.net.ua> <49DE596E.2050406@earthlink.net> <49DEFF53.1040306@icyb.net.ua> <49DF7A1C.90009@root.org> <20090418043432.O34434@sola.nimnet.asn.au> In-Reply-To: <20090418043432.O34434@sola.nimnet.asn.au> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: sclark46@earthlink.net, freebsd-acpi@freebsd.org, freebsd-stable@freebsd.org, Andriy Gapon Subject: Re: 6.x acpi powerbutton X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2009 19:27:36 -0000 Ian Smith wrote: > On Fri, 10 Apr 2009, Nate Lawson wrote: > > Andriy Gapon wrote: > > > on 09/04/2009 23:24 Stephen Clark said the following: > > >> Is there a reason it doesn't send and event like Linux that can be acted > > >> upon by user space other > > >> than signaling init? I like to have a message written in > > >> /var/log/messages that someone pressed > > >> the powerbutton. > > > > > > I think that for all suspend states except S5 userland is notified via > > > devd mechanism and potentially can veto the suspend. S5 (soft-off) is > > > coded to start shutdown immediately. You can try to hack on > > > acpi_ReqSleepState in sys/dev/acpica/acpi.c. > > > > > > I am not sure what is the reason for this special behavior of S5. But I > > > like it, because it sometimes allows me to perform semi-clean shutdown > > > when X goes crazy. But I also see when it could be useful to have S5 > > > request go through userland. So this could be configurable. > > > > The reason for userland getting into the loop in the first place was to > > run programs to shut down devices and reinit them after resume. This > > isn't necessary in the shutdown case because init already sends a > > signal, as you mention. > > > > There's already a mechanism for timing out if userland is not > > responding, so a suspend will ultimately happen whether or not it > > answers. However, that waits for a while (1 minute?) and devd used to be > > optional, so I thought it best to keep the existing S5 behavior > > (immediate shutdown). > > > > It may be ok to enable this for S5 but I don't think it's very useful. > > Perhaps a silly question, but is it too late at this stage of the game > to try logging S5 events to syslog before dying? I agree with Stephen, > logging 'shutdown by powerbutton' surely beats what might otherwise > resemble a spontaneous reboot? Or is something already logged here? I'm not resisting this, but I'm having trouble seeing the importance. What happens differently than if someone hits CTRL-ALT-DEL on a virtual console? -- Nate From owner-freebsd-acpi@FreeBSD.ORG Fri Apr 17 20:30:30 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05040106566B; Fri, 17 Apr 2009 20:30:30 +0000 (UTC) (envelope-from nate@root.org) Received: from nlpi053.prodigy.net (nlpi053.sbcis.sbc.com [207.115.36.82]) by mx1.freebsd.org (Postfix) with ESMTP id C72E38FC08; Fri, 17 Apr 2009 20:30:29 +0000 (UTC) (envelope-from nate@root.org) Received: from [10.0.5.18] (ppp-71-139-8-80.dsl.snfc21.pacbell.net [71.139.8.80]) (authenticated bits=0) by nlpi053.prodigy.net (8.13.8 smtpauth/dk/map_regex/8.13.8) with ESMTP id n3HKUQur026495; Fri, 17 Apr 2009 15:30:26 -0500 Message-ID: <49E8E6E3.40304@root.org> Date: Fri, 17 Apr 2009 13:30:27 -0700 From: Nate Lawson User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Kostik Belousov References: <49DE1F8B.2080400@earthlink.net> <49DE2E6D.5050001@icyb.net.ua> <49DE596E.2050406@earthlink.net> <49DEFF53.1040306@icyb.net.ua> <49DF7A1C.90009@root.org> <20090418043432.O34434@sola.nimnet.asn.au> <49E8D824.1000001@root.org> <20090417200726.GG3014@deviant.kiev.zoral.com.ua> In-Reply-To: <20090417200726.GG3014@deviant.kiev.zoral.com.ua> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: sclark46@earthlink.net, freebsd-acpi@freebsd.org, freebsd-stable@freebsd.org, Ian Smith , Andriy Gapon Subject: Re: 6.x acpi powerbutton X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2009 20:30:30 -0000 Kostik Belousov wrote: > On Fri, Apr 17, 2009 at 12:27:32PM -0700, Nate Lawson wrote: >> Ian Smith wrote: >>> Perhaps a silly question, but is it too late at this stage of the game >>> to try logging S5 events to syslog before dying? I agree with Stephen, >>> logging 'shutdown by powerbutton' surely beats what might otherwise >>> resemble a spontaneous reboot? Or is something already logged here? >> I'm not resisting this, but I'm having trouble seeing the importance. >> What happens differently than if someone hits CTRL-ALT-DEL on a virtual >> console? > > Actually, this is quite reasonable feature. Quite often, machines > do not have physical consoles, or C-A-D is disabled. On the other > hand, power button is quite easy to be pressed by mistake by passing > staff. Sure. Perhaps Andriy will pick up this task after reworking the suspend path code for S5? It seems related. -- Nate From owner-freebsd-acpi@FreeBSD.ORG Fri Apr 17 20:51:26 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70C23106564A for ; Fri, 17 Apr 2009 20:51:26 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id E421E8FC19 for ; Fri, 17 Apr 2009 20:51:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1LuuLR-0004vf-5C; Fri, 17 Apr 2009 23:07:29 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n3HK7Q8X058030 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 17 Apr 2009 23:07:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n3HK7QDE026361; Fri, 17 Apr 2009 23:07:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n3HK7QCB026360; Fri, 17 Apr 2009 23:07:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 17 Apr 2009 23:07:26 +0300 From: Kostik Belousov To: Nate Lawson Message-ID: <20090417200726.GG3014@deviant.kiev.zoral.com.ua> References: <49DE1F8B.2080400@earthlink.net> <49DE2E6D.5050001@icyb.net.ua> <49DE596E.2050406@earthlink.net> <49DEFF53.1040306@icyb.net.ua> <49DF7A1C.90009@root.org> <20090418043432.O34434@sola.nimnet.asn.au> <49E8D824.1000001@root.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BT3sS6uW76RUUBOi" Content-Disposition: inline In-Reply-To: <49E8D824.1000001@root.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, SUBJECT_FUZZY_TION autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1LuuLR-0004vf-5C 0a40015bb57b832fa7ae0a991c370cc8 X-Terabit: YES Cc: sclark46@earthlink.net, freebsd-acpi@freebsd.org, freebsd-stable@freebsd.org, Ian Smith , Andriy Gapon Subject: Re: 6.x acpi powerbutton X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2009 20:51:26 -0000 --BT3sS6uW76RUUBOi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 17, 2009 at 12:27:32PM -0700, Nate Lawson wrote: > Ian Smith wrote: > > Perhaps a silly question, but is it too late at this stage of the game= =20 > > to try logging S5 events to syslog before dying? I agree with Stephen,= =20 > > logging 'shutdown by powerbutton' surely beats what might otherwise=20 > > resemble a spontaneous reboot? Or is something already logged here? >=20 > I'm not resisting this, but I'm having trouble seeing the importance. > What happens differently than if someone hits CTRL-ALT-DEL on a virtual > console? Actually, this is quite reasonable feature. Quite often, machines do not have physical consoles, or C-A-D is disabled. On the other hand, power button is quite easy to be pressed by mistake by passing staff. --BT3sS6uW76RUUBOi Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkno4X0ACgkQC3+MBN1Mb4iNJwCgyMh8EPhp5PsF9t0u9lYJnGRy SOAAoLAnhCwyDY/Ds4b3Zl47lVuslh27 =GcOs -----END PGP SIGNATURE----- --BT3sS6uW76RUUBOi-- From owner-freebsd-acpi@FreeBSD.ORG Fri Apr 17 21:25:07 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A8FD106566B for ; Fri, 17 Apr 2009 21:25:07 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from asmtpout017.mac.com (asmtpout017.mac.com [17.148.16.92]) by mx1.freebsd.org (Postfix) with ESMTP id 3621A8FC23 for ; Fri, 17 Apr 2009 21:25:07 +0000 (UTC) (envelope-from cswiger@mac.com) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Received: from cswiger1.apple.com ([17.227.140.124]) by asmtp017.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KI900G9VI168H70@asmtp017.mac.com>; Fri, 17 Apr 2009 13:24:42 -0700 (PDT) Message-id: <1F394E42-BB02-41AC-8A52-C47A76EC55C9@mac.com> From: Chuck Swiger To: FreeBSD Stable List In-reply-to: <49E8D824.1000001@root.org> Date: Fri, 17 Apr 2009 13:24:42 -0700 References: <49DE1F8B.2080400@earthlink.net> <49DE2E6D.5050001@icyb.net.ua> <49DE596E.2050406@earthlink.net> <49DEFF53.1040306@icyb.net.ua> <49DF7A1C.90009@root.org> <20090418043432.O34434@sola.nimnet.asn.au> <49E8D824.1000001@root.org> X-Mailer: Apple Mail (2.930.3) Cc: freebsd-acpi@freebsd.org Subject: Re: 6.x acpi powerbutton X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2009 21:25:07 -0000 On Apr 17, 2009, at 12:27 PM, Nate Lawson wrote: >> Perhaps a silly question, but is it too late at this stage of the >> game >> to try logging S5 events to syslog before dying? I agree with >> Stephen, >> logging 'shutdown by powerbutton' surely beats what might otherwise >> resemble a spontaneous reboot? Or is something already logged here? > > I'm not resisting this, but I'm having trouble seeing the importance. > What happens differently than if someone hits CTRL-ALT-DEL on a > virtual > console? Well, I'd like to get a one-line message saying "rebooted by CTRL-ALT- DEL" versus "shutdown by powerbutton". Other systems would log a one- liner like "system rebooted by /etc/shutdown -i 6: _MESSAGE_".... Regards, -- -Chuck From owner-freebsd-acpi@FreeBSD.ORG Sat Apr 18 03:22:49 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A7CC106564A for ; Sat, 18 Apr 2009 03:22:49 +0000 (UTC) (envelope-from sclark46@earthlink.net) Received: from elasmtp-mealy.atl.sa.earthlink.net (elasmtp-mealy.atl.sa.earthlink.net [209.86.89.69]) by mx1.freebsd.org (Postfix) with ESMTP id B729B8FC18 for ; Sat, 18 Apr 2009 03:22:48 +0000 (UTC) (envelope-from sclark46@earthlink.net) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=X3fcBir7oEkhe5aq0/tW+o1u3w2Dz8B7AZsGG5HmZ9/MWy//K495m4ENo6tcctDo; h=Received:Message-ID:Date:From:Reply-To:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding:X-ELNK-Trace:X-Originating-IP; Received: from [208.118.36.249] (helo=joker.seclark.com) by elasmtp-mealy.atl.sa.earthlink.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1Lv0xj-0004Rz-Kj; Fri, 17 Apr 2009 23:11:27 -0400 Message-ID: <49E944DE.7080409@earthlink.net> Date: Fri, 17 Apr 2009 23:11:26 -0400 From: Stephen Clark User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: Nate Lawson References: <49DE1F8B.2080400@earthlink.net> <49DE2E6D.5050001@icyb.net.ua> <49DE596E.2050406@earthlink.net> <49DEFF53.1040306@icyb.net.ua> <49DF7A1C.90009@root.org> <20090418043432.O34434@sola.nimnet.asn.au> <49E8D824.1000001@root.org> In-Reply-To: <49E8D824.1000001@root.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ELNK-Trace: a437fbc6971e80f61aa676d7e74259b7b3291a7d08dfec79c5d0ae29ee5d2b2aaf9194ca22ebd21e350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 208.118.36.249 Cc: freebsd-acpi@freebsd.org, freebsd-stable@freebsd.org, Ian Smith , Andriy Gapon Subject: Re: 6.x acpi powerbutton X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: sclark46@earthlink.net List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Apr 2009 03:22:49 -0000 Nate Lawson wrote: > Ian Smith wrote: >> On Fri, 10 Apr 2009, Nate Lawson wrote: >> > Andriy Gapon wrote: >> > > on 09/04/2009 23:24 Stephen Clark said the following: >> > >> Is there a reason it doesn't send and event like Linux that can be acted >> > >> upon by user space other >> > >> than signaling init? I like to have a message written in >> > >> /var/log/messages that someone pressed >> > >> the powerbutton. >> > > >> > > I think that for all suspend states except S5 userland is notified via >> > > devd mechanism and potentially can veto the suspend. S5 (soft-off) is >> > > coded to start shutdown immediately. You can try to hack on >> > > acpi_ReqSleepState in sys/dev/acpica/acpi.c. >> > > >> > > I am not sure what is the reason for this special behavior of S5. But I >> > > like it, because it sometimes allows me to perform semi-clean shutdown >> > > when X goes crazy. But I also see when it could be useful to have S5 >> > > request go through userland. So this could be configurable. >> > >> > The reason for userland getting into the loop in the first place was to >> > run programs to shut down devices and reinit them after resume. This >> > isn't necessary in the shutdown case because init already sends a >> > signal, as you mention. >> > >> > There's already a mechanism for timing out if userland is not >> > responding, so a suspend will ultimately happen whether or not it >> > answers. However, that waits for a while (1 minute?) and devd used to be >> > optional, so I thought it best to keep the existing S5 behavior >> > (immediate shutdown). >> > >> > It may be ok to enable this for S5 but I don't think it's very useful. >> >> Perhaps a silly question, but is it too late at this stage of the game >> to try logging S5 events to syslog before dying? I agree with Stephen, >> logging 'shutdown by powerbutton' surely beats what might otherwise >> resemble a spontaneous reboot? Or is something already logged here? > > I'm not resisting this, but I'm having trouble seeing the importance. > What happens differently than if someone hits CTRL-ALT-DEL on a virtual > console? > Hi Nate, We have over 500 units in the field that are used as firewall/vpn/routers. They have no console, but they do have a powerbutton. We have had customers say the machine turned itself off. It would be nice to know that someone pressed the power button. Thanks, Steve -- "They that give up essential liberty to obtain temporary safety, deserve neither liberty nor safety." (Ben Franklin) "The course of history shows that as a government grows, liberty decreases." (Thomas Jefferson) From owner-freebsd-acpi@FreeBSD.ORG Sat Apr 18 08:28:17 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94AEB106564A; Sat, 18 Apr 2009 08:28:17 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [220.233.188.227]) by mx1.freebsd.org (Postfix) with ESMTP id 05B398FC18; Sat, 18 Apr 2009 08:28:16 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id n3I8SDtH011648; Sat, 18 Apr 2009 18:28:14 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Sat, 18 Apr 2009 18:28:13 +1000 (EST) From: Ian Smith To: Chuck Swiger In-Reply-To: <1F394E42-BB02-41AC-8A52-C47A76EC55C9@mac.com> Message-ID: <20090418170826.T34434@sola.nimnet.asn.au> References: <49DE1F8B.2080400@earthlink.net> <49DE2E6D.5050001@icyb.net.ua> <49DE596E.2050406@earthlink.net> <49DEFF53.1040306@icyb.net.ua> <49DF7A1C.90009@root.org> <20090418043432.O34434@sola.nimnet.asn.au> <49E8D824.1000001@root.org> <1F394E42-BB02-41AC-8A52-C47A76EC55C9@mac.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: freebsd-acpi@freebsd.org, FreeBSD Stable List , Andriy Gapon Subject: Re: 6.x acpi powerbutton X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Apr 2009 08:28:18 -0000 On Fri, 17 Apr 2009, Chuck Swiger wrote: > On Apr 17, 2009, at 12:27 PM, Nate Lawson wrote: > > > Perhaps a silly question, but is it too late at this stage of the game > > > to try logging S5 events to syslog before dying? I agree with Stephen, > > > logging 'shutdown by powerbutton' surely beats what might otherwise > > > resemble a spontaneous reboot? Or is something already logged here? > > > > I'm not resisting this, but I'm having trouble seeing the importance. > > What happens differently than if someone hits CTRL-ALT-DEL on a virtual > > console? > > Well, I'd like to get a one-line message saying "rebooted by CTRL-ALT-DEL" > versus "shutdown by powerbutton". Other systems would log a one-liner like > "system rebooted by /etc/shutdown -i 6: _MESSAGE_".... I don't know about C-A-D as I've always disabled it in my kernels - lest some 'windows expert' may be hoping to see a TaskList - but 'reboot' and 'shutdown -[rhp] ..' are already logged nicely: May 31 16:25:26 paqi reboot: rebooted by root May 31 16:25:26 paqi syslogd: exiting on signal 15 May 31 16:26:30 paqi syslogd: kernel boot file is /boot/kernel/kernel Mar 31 20:04:14 paqi shutdown: power-down by smithi: down after fixing localtime Sydney Mar 31 19:04:32 paqi named[16442]: stopping command channel on 127.0.0.1#953 Mar 31 19:04:33 paqi named[16442]: exiting Mar 31 19:04:33 paqi syslogd: exiting on signal 15 Mar 31 19:07:16 paqi syslogd: kernel boot file is /boot/kernel/kernel I suspect a 'windows expert' would have to break down doors to get to Nate's boxes, but for those of us condemned to being remote catherders, a powerbutton shutdown message would be helpful. cheers, Ian From owner-freebsd-acpi@FreeBSD.ORG Sat Apr 18 11:11:51 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 709A3106566C; Sat, 18 Apr 2009 11:11:51 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.43]) by mx1.freebsd.org (Postfix) with ESMTP id 28EE78FC17; Sat, 18 Apr 2009 11:11:50 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from [62.143.132.243] (helo=localhost) by smtprelay05.ispgateway.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1Lv8FT-0001YC-3L; Sat, 18 Apr 2009 12:58:15 +0200 Date: Sat, 18 Apr 2009 12:58:06 +0200 From: Fabian Keil To: Andriy Gapon Message-ID: <20090418125806.2a48b0a8@fabiankeil.de> In-Reply-To: <49E8AED0.1090008@freebsd.org> References: <49DB639A.4090504@icyb.net.ua> <49DCF5C2.60805@root.org> <49DDF906.8090400@icyb.net.ua> <49DF3CA4.1090309@freebsd.org> <49E4B2A7.3020302@freebsd.org> <49E61986.7040709@root.org> <49E8AED0.1090008@freebsd.org> X-Mailer: Claws Mail 3.7.1 (GTK+ 2.14.7; i386-portbld-freebsd8.0) X-PGP-KEY-URL: http://www.fabiankeil.de/gpg-keys/freebsd-listen-2008-08-18.asc Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/2X_WvpGp6xY=9zIfG8MaHP="; protocol="application/pgp-signature"; micalg=PGP-SHA1 X-Df-Sender: 775067 Cc: freebsd-acpi@freebsd.org Subject: Re: run resume code only for S1-S4 states X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-acpi@freebsd.org List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Apr 2009 11:11:51 -0000 --Sig_/2X_WvpGp6xY=9zIfG8MaHP= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Andriy Gapon wrote: > An updated version of the patch, the only difference is: do-while(0) is g= one, > breaks are replaces with gotos, indentation is reduced. >=20 > Per Nate's request I am calling for people with SMP systems to test if po= wering > off via power button still works with this change. It's desirable to test= power > off at least two times to increase a chance of non-BSP CPU being used. With an AMD Athlon(tm) 64 X2 Dual Core Processor 4600+ (2542.15-MHz K8-clas= s CPU) the first few shutdowns were successful, but on the fourth try pressing the power button only lead to: Apr 18 12:52:42 kendra kernel: acpi: suspend request ignored (not ready yet) Apr 18 12:52:42 kendra kernel: acpi: request to enter state S5 failed (err = 6) Apr 18 12:52:43 kendra kernel: acpi: suspend request ignored (not ready yet) Apr 18 12:52:43 kendra kernel: acpi: request to enter state S5 failed (err = 6) Apr 18 12:52:43 kendra kernel: acpi: suspend request ignored (not ready yet) Apr 18 12:52:43 kendra kernel: acpi: request to enter state S5 failed (err = 6) [...] Fabian --Sig_/2X_WvpGp6xY=9zIfG8MaHP= Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEARECAAYFAknpskYACgkQBYqIVf93VJ0FdgCghyZpKl5gVktJNbtOHEHcVfLd apkAn1VRq+9AYvLo2DgdLTCdMOQOb2FC =6NuZ -----END PGP SIGNATURE----- --Sig_/2X_WvpGp6xY=9zIfG8MaHP=-- From owner-freebsd-acpi@FreeBSD.ORG Sat Apr 18 16:28:34 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9002A106568A; Sat, 18 Apr 2009 16:28:34 +0000 (UTC) (envelope-from nate@root.org) Received: from nlpi001.prodigy.net (nlpi001.sbcis.sbc.com [207.115.36.30]) by mx1.freebsd.org (Postfix) with ESMTP id 5E90C8FC13; Sat, 18 Apr 2009 16:28:34 +0000 (UTC) (envelope-from nate@root.org) Received: from [10.0.5.18] (ppp-71-139-8-80.dsl.snfc21.pacbell.net [71.139.8.80]) (authenticated bits=0) by nlpi001.prodigy.net (8.13.8 smtpauth/dk/map_regex/8.13.8) with ESMTP id n3IGSWKm021485; Sat, 18 Apr 2009 11:28:32 -0500 Message-ID: <49E9FFB0.6090707@root.org> Date: Sat, 18 Apr 2009 09:28:32 -0700 From: Nate Lawson User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: freebsd-acpi@freebsd.org References: <49DB639A.4090504@icyb.net.ua> <49DCF5C2.60805@root.org> <49DDF906.8090400@icyb.net.ua> <49DF3CA4.1090309@freebsd.org> <49E4B2A7.3020302@freebsd.org> <49E61986.7040709@root.org> <49E8AED0.1090008@freebsd.org> <20090418125806.2a48b0a8@fabiankeil.de> In-Reply-To: <20090418125806.2a48b0a8@fabiankeil.de> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Andriy Gapon Subject: Re: run resume code only for S1-S4 states X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Apr 2009 16:28:36 -0000 Fabian Keil wrote: > Andriy Gapon wrote: > >> An updated version of the patch, the only difference is: do-while(0) is gone, >> breaks are replaces with gotos, indentation is reduced. >> >> Per Nate's request I am calling for people with SMP systems to test if powering >> off via power button still works with this change. It's desirable to test power >> off at least two times to increase a chance of non-BSP CPU being used. > > With an AMD Athlon(tm) 64 X2 Dual Core Processor 4600+ (2542.15-MHz K8-class CPU) > the first few shutdowns were successful, but on the fourth try pressing the > power button only lead to: > > Apr 18 12:52:42 kendra kernel: acpi: suspend request ignored (not ready yet) > Apr 18 12:52:42 kendra kernel: acpi: request to enter state S5 failed (err 6) > Apr 18 12:52:43 kendra kernel: acpi: suspend request ignored (not ready yet) > Apr 18 12:52:43 kendra kernel: acpi: request to enter state S5 failed (err 6) > Apr 18 12:52:43 kendra kernel: acpi: suspend request ignored (not ready yet) > Apr 18 12:52:43 kendra kernel: acpi: request to enter state S5 failed (err 6) > [...] Yes, I think the case for S5 should probably come before acpi_sleep_disable(). -- Nate