From: Bhavna Sarathy <bnagendr@redhat.com> Date: Fri, 30 Oct 2009 14:40:39 -0400 Subject: [apic] fix server c1e spurious lapic timer events Message-id: <20091030144309.18682.97329.sendpatchset@localhost.localdomain> Patchwork-id: 21274 O-Subject: [RHEL5 PATCH] Fix server C1E spurious lapic timer events Bugzilla: 519422 RH-Acked-by: Prarit Bhargava <prarit@redhat.com> RH-Acked-by: Christopher Lalancette <clalance@redhat.com> Resolves 519422 Server C1E is a low power state defined on AMD systems. A disabled APIC timer interrupt still causes an early exit from C1e. The patch avoids spurious lapic timer events on shutdown. The apic timer might be close to firing when it is shutdown. We cannot really disable the timer - we just mask the interrupt. That way we can get an extra interrupt when it is reenabled. Set the counter to max on shutdown to avoid this. Upstream patch: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a98f8fd24fb24fcb9a359553e64dd6aac5cf4279 The code that was introduced by Thomas Gleixner (tglx) with commit a98f8fd24fb24fcb9a359553e64dd6aac5cf4279 (x86: apic reset counter on shutdown) with kernel 2.6.28. Testing: Patch tested on Dinar 2P system, and regression tested to ensure no sideeffects from introducing this patch. Please review and ACK diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c index 47a4e02..6e05f68 100644 --- a/arch/i386/kernel/apic.c +++ b/arch/i386/kernel/apic.c @@ -1181,6 +1181,7 @@ void disable_APIC_timer(void) */ v |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR); apic_write_around(APIC_LVTT, v); + apic_write(APIC_TMICT, 0xffffffff); } } diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c index 9a82ceb..c518f62 100644 --- a/arch/x86_64/kernel/apic.c +++ b/arch/x86_64/kernel/apic.c @@ -896,6 +896,7 @@ void disable_APIC_timer(void) */ v |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR); apic_write(APIC_LVTT, v); + apic_write(APIC_TMICT, 0xffffffff); } }