From owner-freebsd-acpi@FreeBSD.ORG Wed Mar 25 16:41:11 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 ACD611065691 for ; Wed, 25 Mar 2009 16:41:11 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id E09EA8FC13 for ; Wed, 25 Mar 2009 16:41:10 +0000 (UTC) (envelope-from avg@icyb.net.ua) 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 SAA18163; Wed, 25 Mar 2009 18:41:07 +0200 (EET) (envelope-from avg@icyb.net.ua) Message-ID: <49CA5EA3.3000500@icyb.net.ua> Date: Wed, 25 Mar 2009 18:41:07 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.21 (X11/20090323) MIME-Version: 1.0 To: Nate Lawson References: <49C8E143.2080305@icyb.net.ua> <49CA57E2.7090805@root.org> <49CA5AC9.1040601@icyb.net.ua> <49CA5BBE.2040305@root.org> In-Reply-To: <49CA5BBE.2040305@root.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: shutdown via power button: "acpi: resumed at..." 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, 25 Mar 2009 16:41:12 -0000 on 25/03/2009 18:28 Nate Lawson said the following: > Andriy Gapon wrote: >> on 25/03/2009 18:12 Nate Lawson said the following: >>> Andriy Gapon wrote: >>>> I noticed that sometimes I am getting "acpi: resumed at..." message on console and >>>> in system log when I initiate system shutdown by pressing power button. >>>> I think that the cause is in acpi_UserNotify("Resume") call and this call is only >>>> found in acpi_EnterSleepState(). >>>> >>>> I see the following code in that function: >>>> case ACPI_STATE_S5: >>>> /* >>>> * Shut down cleanly and power off. This will call us back through the >>>> * shutdown handlers. >>>> */ >>>> shutdown_nice(RB_POWEROFF); >>>> break; >>>> >>>> So it seems that it is expected that shutdown_nice() would return immediately. >>>> I think it makes S5 a special case comparing to other states where return happens >>>> upon resuming from the state. >>>> In this case, maybe it is not necessary for S5 request to go through the >>>> resume/wakeup half of acpi_EnterSleepState. >>>> >>> I thought shutdown*() should never return at all. It sounds like >>> interrupts are being re-enabled or something. >>> >> No, this is a different kind of shutdown, this one just send a signal to init: >> void >> shutdown_nice(int howto) >> { >> >> shutdown_howto = howto; >> >> /* Send a signal to init(8) and have it shutdown the world */ >> if (initproc != NULL) { >> PROC_LOCK(initproc); >> psignal(initproc, SIGINT); >> PROC_UNLOCK(initproc); >> } else { >> /* No init(8) running, so simply reboot */ >> boot(RB_NOSYNC); >> } >> return; >> } > > But the shutdown that is initiated through ACPI is RB_POWEROFF. Not sure what exactly you meant here, so can't argue, just can comment - we are just handing power button press in acpi_EnterSleepState. > There > should be no returning from there. What has changed in the code so that > RB_POWEROFF does not immediately call back into acpi_shutdown_final() > which powers off the system? I am not sure what you are asking here, so I can't answer, but... power off or not, shouldn't userland be given a chance to shutdown gracefully? I thought it always worked this way. > Anyway, the resume notification could be moved under the "if (state != > S5)" line right above it if this behavior is legal. > Yes, I also think so. -- Andriy Gapon