Skip to contentSkip to conversation

2.4 UP_APIC power management fix

PATCH New Mikael Pettersson 1 participant 1 message Oct 27, 2001

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.4 UP_APIC power management fix

The 2.4 UP_APIC code sets up a handler for power management events, but only if the local APIC was enabled by Linux. This needs to be done unconditionally: even if Linux didn't enable the local APIC, we will still reprogram it in ways the BIOS may not handle.

This is the case on my new P4 box, which boots with the local APIC enabled. With a 2.2 kernel or 2.4 kernel w/o SMP or UP_APIC, APM suspend works fine. With a 2.4 UP_APIC kernel and the P4 anti-hang patch to detect_init_APIC() I posted a few hours ago, APM suspend hangs the machine. If detect_init_APIC() sets up the PM handler unconditionally, suspend works.

Setting up the PM handler unconditionally shouldn't cause any problems for UP P6/K7 boxes: most of them boot with the local APIC disabled, so we would have set up the PM handler anyway.

The patch below implements this change. Please try it out.

/Mikael

arch/i386/kernel/apic.c renamed from arch/i386/kernel/apic.c.~1~ +1 -4
@@ -575,7 +575,6 @@
 static int __init detect_init_APIC (void)
 {
 	u32 h, l, features;
-	int needs_pm = 0;
 	extern void get_cpu_vendor(struct cpuinfo_x86*);
 
 	/* Workaround for us being called before identify_cpu(). */
@@ -607,7 +607,6 @@
 			l &= ~MSR_IA32_APICBASE_BASE;
 			l |= MSR_IA32_APICBASE_ENABLE | APIC_DEFAULT_PHYS_BASE;
 			wrmsr(MSR_IA32_APICBASE, l, h);
-			needs_pm = 1;
 		}
 	}
 	/*
@@ -627,8 +626,7 @@
 
 	printk("Found and enabled local APIC!\n");
 
-	if (needs_pm)
-		apic_pm_init1();
+	apic_pm_init1();
 
 	return 0;