NetBSD Problem Report #38936

From martin@duskware.de  Tue Jun 10 20:18:25 2008
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 7066363B8BC
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 10 Jun 2008 20:18:25 +0000 (UTC)
Message-Id: <20080610201822.B3B8833A87@mail.duskware.de>
Date: Tue, 10 Jun 2008 22:18:22 +0200 (CEST)
From: martin@duskware.de
Reply-To: martin@duskware.de
To: gnats-bugs@gnats.NetBSD.org
Subject: system can not power down via acpi
X-Send-Pr-Version: 3.95

>Number:         38936
>Category:       port-i386
>Synopsis:       system can not power down via acpi
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jmcneill
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 10 20:20:00 +0000 2008
>Closed-Date:    Mon Mar 02 20:46:58 +0000 2009
>Last-Modified:  Mon Mar 02 20:46:58 +0000 2009
>Originator:     Martin Husemann
>Release:        NetBSD 4.99.64
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD night-porter.duskware.de 4.99.64 NetBSD 4.99.64 (PORTER) #50: Tue Jun 10 18:56:22 CEST 2008 martin@night-porter.duskware.de:/usr/src/sys/arch/i386/compile/PORTER i386
Architecture: i386
Machine: i386
>Description:

My system seems to be unable to power off via ACPI.
It does all the pmf magic, then says:

acpi: entering state 5

and then seems to hang in the call to AcpiEnterSleepStatePrep(), or if I 
comment that, in AcpiEnterSleepState().

Bug in my ACPI bios (not unlikely, server works chipset, asus bios, CUR-DLS
board, bios is latest available beta from asus [from 2002]).

Side note: if AcpiEnterSleepState() would fail (which, of course, it should
not), the return value is ignored and acpi_enter_sleep_state() will return
success.

>How-To-Repeat:

on my machine:
shutdown -p now 

>Fix:
Create an option (or a quirk table?) to avoid trying to power down via acpi
and use apm instead? But maybe that will only cause us to hit PR 37434 ;-}

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-i386/38936: system can not power down via acpi
Date: Wed, 11 Jun 2008 21:59:14 +0200

 Booting to single user and then:

 # sysctl -w machdep.sleep_state=5

 powers down the system.

 Martin

From: Markus W Kilbinger <mk@kilbi.de>
To: gnats-bugs@NetBSD.org
Cc: port-i386-maintainer@netbsd.org,
    gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org,
    martin@duskware.de
Subject: Re: port-i386/38936: system can not power down via acpi
Date: Thu, 12 Jun 2008 18:54:15 +0200

 >>>>> "Martin" == Martin Husemann <martin@duskware.de> writes:

     Martin> The following reply was made to PR port-i386/38936; it has
     Martin> been noted by GNATS. From: Martin Husemann
     Martin> <martin@duskware.de> To: gnats-bugs@NetBSD.org Cc:
     Martin> Subject: Re: port-i386/38936: system can not power down
     Martin> via acpi Date: Wed, 11 Jun 2008 21:59:14 +0200

     Martin>  Booting to single user and then:

     Martin>  # sysctl -w machdep.sleep_state=5

     Martin>  powers down the system.

 Great finding, works on my A7M266-D too! :-)

 -> How to integrate it this finding into 'shutdown -p now'?

 Markus.

From: Martin Husemann <martin@duskware.de>
To: Markus W Kilbinger <mk@kilbi.de>
Cc: gnats-bugs@NetBSD.org
Subject: Re: port-i386/38936: system can not power down via acpi
Date: Thu, 12 Jun 2008 23:50:58 +0200

 On Thu, Jun 12, 2008 at 06:54:15PM +0200, Markus W Kilbinger wrote:
 > -> How to integrate it this finding into 'shutdown -p now'?

 Well, it does the same already, plus some more. Since the pure acpi state
 transition works, it must be something we do in preparation for it that
 breaks things.

 Unfortunately testing on my machine is extremely inconvenient, can you test
 on your machine easily? I guess the next step would be to test with
 pmf_system_shutdown() doing nothing.

 Martin

From: Markus W Kilbinger <mk@kilbi.de>
To: Martin Husemann <martin@duskware.de>
Cc: gnats-bugs@NetBSD.org
Subject: Re: port-i386/38936: system can not power down via acpi
Date: Sat, 14 Jun 2008 22:40:44 +0200

 >>>>> "Martin" == Martin Husemann <martin@duskware.de> writes:

     Martin> [...] can you test on your machine easily? I guess the
     Martin> next step would be to test with pmf_system_shutdown()
     Martin> doing nothing.

 I can try that tomorrow (I hope).

 BTW: How to activate all this nice aprint_debug output in kern_pmf.c?
      'boot -x' didn't work for me...

 Markus.

From: Martin Husemann <martin@duskware.de>
To: Markus W Kilbinger <mk@kilbi.de>
Cc: gnats-bugs@NetBSD.org
Subject: Re: port-i386/38936: system can not power down via acpi
Date: Sat, 14 Jun 2008 23:05:46 +0200

 On Sat, Jun 14, 2008 at 10:40:44PM +0200, Markus W Kilbinger wrote:
 > BTW: How to activate all this nice aprint_debug output in kern_pmf.c?
 >      'boot -x' didn't work for me...

 Yeah, that is PR #38937 ;-)
 Joerg suggested a fix, I'll appen a patch to the PR in a few minutes.

 Martin

From: Markus W Kilbinger <mk@kilbi.de>
To: Martin Husemann <martin@duskware.de>
Cc: gnats-bugs@NetBSD.org
Subject: Re: port-i386/38936: system can not power down via acpi
Date: Sun, 15 Jun 2008 01:43:10 +0200

 >>>>> "Martin" == Martin Husemann <martin@duskware.de> writes:

     >> BTW: How to activate all this nice aprint_debug output in
     >> kern_pmf.c? 'boot -x' didn't work for me...

     Martin> Yeah, that is PR #38937 ;-) Joerg suggested a fix, I'll
     Martin> appen a patch to the PR in a few minutes.

 Ah, ok .. ;-)

 For a first step I've commented out pmf_system_shutdown()'s call in
 kern_subr.c, but that produced the same hangup/not power off.

 So, where is the acpi state transition finally done for 'shutdown -p
 now'?

 ... and is this exactly the same place as for the manual way ('sysctl
 -w ...')?

 Markus.

From: Markus W Kilbinger <mk@kilbi.de>
To: Martin Husemann <martin@duskware.de>
Cc: gnats-bugs@NetBSD.org
Subject: Re: port-i386/38936: system can not power down via acpi
Date: Sun, 15 Jun 2008 19:32:26 +0200

 >>>>> "Martin" == Martin Husemann <martin@duskware.de> writes:

     Martin> Well, it does the same already, plus some more. Since the
     Martin> pure acpi state transition works, it must be something we
     Martin> do in preparation for it that breaks things.

 I digged around that and found that simply commenting out the
 x86_broadcast_ipi(X86_IPI_HALT) call

   Index: machdep.c
   ===================================================================
   RCS file: /cvsroot/src/sys/arch/i386/i386/machdep.c,v
   retrieving revision 1.636
   diff -u -r1.636 machdep.c
   --- machdep.c   5 Jun 2008 21:44:31 -0000       1.636
   +++ machdep.c   15 Jun 2008 17:24:06 -0000
   @@ -897,9 +897,11 @@
           /* Disable interrupts. */
           (void)splhigh();

   +       /*
    #ifdef MULTIPROCESSOR
           x86_broadcast_ipi(X86_IPI_HALT);
    #endif
   +       */

           if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
    #ifdef XEN

 made 'shutdown -p now' working again. Wakeup on lan is also working
 after that...

 All other commenting out trials (shutdown hooks, pmf stuff) didn't
 change the otherwise 'shutdown -p now' hangup anyway.

 So, is 'x86_broadcast_ipi(X86_IPI_HALT);' superflous?

 Or does that call has to be reorder in the sequence of the other
 shutdown preparation steps? (I didn't try that...)

 Markus.

Responsible-Changed-From-To: port-i386-maintainer->jmcneill
Responsible-Changed-By: jmcneill@NetBSD.org
Responsible-Changed-When: Thu, 26 Feb 2009 15:09:14 +0000
Responsible-Changed-Why:
I checked in a fix.


State-Changed-From-To: open->feedback
State-Changed-By: jmcneill@NetBSD.org
State-Changed-When: Thu, 26 Feb 2009 15:09:14 +0000
State-Changed-Why:
Does arch/i386/i386/machdep.c r1.664 resolve this issue for you? If so it needs
to be pulled up to 5.0.


From: "Jared D. McNeill" <jmcneill@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/38936 CVS commit: src/sys/arch/i386/i386
Date: Thu, 26 Feb 2009 15:07:33 +0000 (UTC)

 Module Name:	src
 Committed By:	jmcneill
 Date:		Thu Feb 26 15:07:33 UTC 2009

 Modified Files:
 	src/sys/arch/i386/i386: machdep.c

 Log Message:
 PR# port-i386/38936: system can not power down via acpi

 Merge change from amd64 machdep.c revision 1.42:

 in cpu_reboot(), only halt the other CPUs after we've done the powerdown stuff.
 the ACPI code may end up removing some pmap entries, which wants the other
 CPUs to still be running to handle TLB invalidations.


 To generate a diff of this commit:
 cvs rdiff -r1.663 -r1.664 src/sys/arch/i386/i386/machdep.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: feedback->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Thu, 26 Feb 2009 20:58:50 +0000
State-Changed-Why:
yes, this fixes it


State-Changed-From-To: closed->pending-pullups
State-Changed-By: jmcneill@NetBSD.org
State-Changed-When: Thu, 26 Feb 2009 21:56:23 +0000
State-Changed-Why:
[pullup-5 #529] PR# port-i386/38936: system can not power down via acpi


State-Changed-From-To: pending-pullups->closed
State-Changed-By: jmcneill@NetBSD.org
State-Changed-When: Mon, 02 Mar 2009 20:46:58 +0000
State-Changed-Why:
Fixed in 5.0.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.