Bug 5099

Summary: System powers down when rebooting 2.6.13-rc[456]
Product: ACPI Reporter: Masoud Sharbiani (masouds)
Component: Power-OffAssignee: Alexey Starikovskiy (astarikovskiy)
Status: CLOSED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: acpi-bugzilla, masouds
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.13-rc6 Subsystem:
Regression: --- Bisected commit-id:
Attachments: Kernel config file
kernel messages
lspci -vv output
lspci -vv output
lspci -vv output
set system_state at S4 power-off

Description Masoud Sharbiani 2005-08-20 20:18:25 UTC
Distribution:Ubuntu 5.04
Hardware Environment: 
Dual P3/866MHz
768 megs of PC-133 RAM
MSI 694-D2 Ver. 2 motherboard
a 200 Gig IDE hdd, 10X IDE cdrom
Via-Rhine NIC
SYM- SCSI card.

Software Environment:
Using kernel 2.6.13-rc4 through latest rc6 (as of two days ago).
gcc-3.3.5
Problem Description:
I've booted the machine using 2.6.13-rc4 and/or later kernels and after boot, 
I've tried rebooting it (either immediately or after some normal-compilation, 
testing). At the end of reboot cycle, it just powers off.
Earlier 2.6.13-rcX kernels panic during startup. 2.6.12.5 works just fine.

Steps to reproduce:
Boot the kernel, type 'reboot' on command line and watch the machine act as if 
you've called halt -p on it. It doesn't happen if you add 'reboot=w' 
or 'acpi=off' to the kernel command line before booting.
Comment 1 Masoud Sharbiani 2005-08-22 08:41:39 UTC
Apparently, another guy has also the same problem, with a different hardware:
http://lkml.org/lkml/2005/8/20/57
Comment 2 Masoud Sharbiani 2005-08-22 11:09:07 UTC
Created attachment 5725 [details]
Kernel config file

This is the config file used to compile the kernel
Comment 3 Masoud Sharbiani 2005-08-22 11:10:04 UTC
Created attachment 5726 [details]
kernel messages

This is dmesg after boot, with 'reboot=w' added to commandline.
Comment 4 Masoud Sharbiani 2005-08-22 11:10:27 UTC
Created attachment 5727 [details]
lspci -vv output
Comment 5 Masoud Sharbiani 2005-08-22 11:10:35 UTC
Created attachment 5728 [details]
lspci -vv output
Comment 6 Masoud Sharbiani 2005-08-22 11:10:56 UTC
Created attachment 5729 [details]
lspci -vv output

Output of lspci -vv
Comment 7 Len Brown 2005-08-22 13:53:08 UTC
can you isolate where between 2.6.12 aznd 2.6.12-rc3 the
regression begain?

Alternatively, can you see if the latest ACPI patch
caused this regression?  It is located here and
you can apply it to 2.6.12.*:
http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/patches/release/2.6.12/
Comment 8 Masoud Sharbiani 2005-08-22 20:24:53 UTC
2.6.12.5 works.
2.6.13-rc1 through 2.6.13-rc3 crash at boot (I'll recompile them and post the 
log messages here.)
2.6.13-rc4 through 2.6.13-rc6 shutdown on crash. 
I shall also try the patch you mentioned.
Comment 9 Masoud Sharbiani 2005-08-22 20:57:42 UTC
Yes.  The patch at 
http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/patches/release/2.6.12/
acpi-20050729-2.6.12.diff.gz shuts down the machine when executing reboot.
Comment 10 Masoud Sharbiani 2005-08-22 21:41:25 UTC
The patch at 
http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/patches/release/2.6.12/
broken-out/acpi-4-poweroff-alexey.y.starikovskiy@intel.com.patch, when added 
to 2.6.12.5 also powers off the system on reboot.
Comment 11 Masoud Sharbiani 2005-08-23 08:51:51 UTC
I modified portions of the code touched by the patch so that the functions print
their name on the way on reboot: 
 * Rebooting...        <--- This is the init  (or initscripts) message.        
                                                
acpi_shutdown: called.                                                          
acpi_sleep_prepare: state=5                                                     
Restarting system.                                                              

On a separate note, Machine shuts off even with CPU triple faulting. I commented
out the code handing reset via keyboard controller (since the machine is
attached to a KVM, and most of the time, the other machine is using the
keyboard). It still turned itself off at the end of reboot.
Comment 12 Masoud Sharbiani 2005-08-29 08:48:39 UTC
There is a patch in http://lkml.org/lkml/2005/8/27/8 (also included in 2.6.13
final) that fixes this issue:
diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c
--- a/drivers/acpi/sleep/poweroff.c
+++ b/drivers/acpi/sleep/poweroff.c
@@ -55,7 +55,11 @@ void acpi_power_off(void)
 
 static int acpi_shutdown(struct sys_device *x)
 {
-	return acpi_sleep_prepare(ACPI_STATE_S5);
+	if (system_state == SYSTEM_POWER_OFF) {
+		/* Prepare if we are going to power off the system */
+		return acpi_sleep_prepare(ACPI_STATE_S5);
+	}
+	return 0;
 }
Comment 13 Alexey Starikovskiy 2005-09-01 07:02:50 UTC
Created attachment 5843 [details]
set system_state at S4 power-off

Could you please verify that this patch does not break your setup?
Comment 14 Masoud Sharbiani 2005-09-01 07:49:42 UTC
And what should I apply this patch to? 
Comment 15 Alexey Starikovskiy 2005-09-01 08:35:18 UTC
Please apply over patch in #12, e.g. to 2.6.13 kernel. Thanks.
Comment 16 Masoud Sharbiani 2005-09-01 10:46:35 UTC
Unfortunately, I can't boot 2.6.13 on this machine: See bug 5171.
Comment 17 Masoud Sharbiani 2005-09-26 19:44:25 UTC
The bug seems to be fixed in 2.6.14-rc2; It reboots without any external 
command line switch.