Dell I8000, 2.4.8-ac5 and APM
Quoted 11 lines · Georg Nikodym
Quoted 6 lines
On my Dell I8000, when running 2.48-ac5 pulling the AC plug out (or plugging it back) causes the box to hang for a while prior to shutting itself off.
I first reported this in 2.4.5-ac13 but didn't have the time to poke around.
Looking at
apm.c, there's not enough difference to account for this regression so I started looking more broadly. I found that in the -ac tree there's a bunch of power management code that's been added toarch/i386/kernel/apic.c(by Mikael Petterson).
The PM code in apic.c is _required_ if you want power management to work at all with a local APIC enabled kernel.
The problem is that on most UP boxes, the BIOS boots the OS with the local APIC disabled, and it expects the local APIC to stay disabled, especially at suspend when the BIOS SMM is activated. Failure of the OS to disable the local APIC before suspend can cause the machine to hang hard. The PM code in apic.c and nmi.c is there to prevent this.
Concerning your problem with pulling the AC plug on your Dell I8000, my suspicion is that either (a) the BIOS isn't notifying apm.c of the event, or (b) apm.c fails to propagate the event to its PM clients.
(Case (b) is known to cause problems for "apm --standby" since apm.c [for whatever reason] doesn't propagate STANDBY events to PM clients. See the "2.4.5-ac8 hardlocks when going to standby" thread from early June this year.)
Quoted 4 lines
Disabling APIC solves my immediate problem, so personally I'm happy.
Obviously, that not The Right Thing (tm) so Mikael, if you want a debugging guinea pig, feel free to contact me.
Try the patch below and configure with CONFIG_X86_UP_APIC disabled. Reboot. Pull the AC plug. What debug output did apm.c dump in the kernel log? If it said something about send_event() ignoring some event, then that's a prime suspect.
/Mikael
arch/i386/kernel/apm.c renamed from arch/i386/kernel/apm.c.~1~ +8 -1
@@ -347,7 +347,7 @@static long clock_cmos_diff;static int got_clock_diff;#endif -static int debug; +static int debug =1 ;static int apm_disabled =-1 ;#ifdef CONFIG_SMP static int power_off;
@@ -947,6 +947,13 @@/* map all resumes to ACPI D0 */ (void )pm_send_all (PM_RESUME , (void *)0 );break ; +default : +if (debug) +printk (KERN_DEBUG "apm: send_event() ignored event 0x%02x (%s)\n" , + event, + (event >NR_APM_EVENT_NAME ) + ?"unknown" + : apm_event_name[event -1 ]); }return 1 ;
Quoted 4 lines · Mikael Pettersson
Try the patch below and configure with
CONFIG_X86_UP_APICdisabled. Reboot. Pull the AC plug. What debug output didapm.cdump in the kernel log? If it said something aboutsend_event()ignoring some event, then that's a prime suspect.
Each plug/unplug event generates:
apm: received power status change notify
apm: send_event() ignore event 0x06 (power status change)
Quoted 3 lines · [email protected] said:
Concerning your problem with pulling the AC plug on your Dell I8000,
my suspicion is that either (a) the BIOS isn't notifyingapm.cof the event, or (b)apm.cfails to propagate the event to its PM clients.
The problem with suspend actually turned out to be because the APIC is unconditionally enabled _before_ the command line is scanned and the 'noapic' option is detected. The noapic option, however, does have the effect of preventing the registration of the power management code :)
Booting with 'apic' makes the thing take some time to suspend, and then it reboots instead of resuming. That may be your case (b). I put printk in the apic suspend and resume functions and neither of them seem to appear.
--
dwmw2
Quoted 8 lines · David Woodhouse
Quoted 3 lines · [email protected] said:
Concerning your problem with pulling the AC plug on your Dell I8000,
my suspicion is that either (a) the BIOS isn't notifyingapm.cof the event, or (b)apm.cfails to propagate the event to its PM clients.The problem with suspend actually turned out to be because the APIC is unconditionally enabled _before_ the command line is scanned and the 'noapic' option is detected.
Right, the local APIC is enabled very early, for some reason I don't recall right now.
Quoted 2 lines
The noapic option, however, does have the effect of preventing the registration of the power management code :)
Hmm, the "noapic" kernel option does not and never has had anything to do with the local APIC, only the IO-APIC which is a completely different beast. However, RedHat 7.1+ added a bug in init/main.c where they bypass the second half of the UP APIC initialisation if "noapic" is specified. So using "noapic" you now end up with the local APIC enabled but its PM code disabled. Nice, eh?
Quoted 3 lines
Booting with 'apic' makes the thing take some time to suspend, and then it reboots instead of resuming. That may be your case (b). I put printk in the apic suspend and resume functions and neither of them seem to appear.
Please try this with a normal 2.4-ac kernel. Add a printk and a delay at the top of apm.c's send_event() so we can see exactly which events occur. Boot with UP_APIC enabled. Initiate suspend: did apm.c log an event and if so which one? Try to resume: did apm.c log anything before the machine rebooted?
/Mikael