Skip to contentSkip to conversation

x86, apic: Clear APIC Timer Initial Count Register on shutdown

PATCH In review Andreas Herrmann 1 participant 2 messages Oct 27, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86, apic: Clear APIC Timer Initial Count Register on shutdown

Commit a98f8fd24fb24fcb9a359553e64dd6aac5cf4279 (x86: apic reset counter on shutdown) set the counter to max to avoid spurious interrupts when the timer is re-enabled.

(In theory) you'll still get a spurious interrupt if spending more than 344 seconds with this interrupt disabled and then unmasking it.

The right thing to do is to clear the register. This disables the interrupt from happening (at least it does on AMD hardware).

---
 arch/x86/kernel/apic/apic.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/apic/apic.c +1 -1
index dce93d4..4c689f4 100644
@@ -444,7 +444,7 @@ static void lapic_timer_setup(enum clock_event_mode mode,
 		v = apic_read(APIC_LVTT);
 		v |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR);
 		apic_write(APIC_LVTT, v);
-		apic_write(APIC_TMICT, 0xffffffff);
+		apic_write(APIC_TMICT, 0);
 		break;
 	case CLOCK_EVT_MODE_RESUME:
 		/* Nothing to do here */
Signature · 1 line
1.6.2.5
#1 lore raw
Commit-ID:  6f9b41006af1bc489030f84ee247abc0df1edccd
Gitweb:     http://git.kernel.org/tip/6f9b41006af1bc489030f84ee247abc0df1edccd
Author:     Andreas Herrmann <[email protected]>
AuthorDate: Tue, 27 Oct 2009 11:01:38 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 27 Oct 2009 14:54:21 +0100

x86, apic: Clear APIC Timer Initial Count Register on shutdown

Commit a98f8fd24fb24fcb9a359553e64dd6aac5cf4279 (x86: apic reset counter on shutdown) set the counter to max to avoid spurious interrupts when the timer is re-enabled.

(In theory) you'll still get a spurious interrupt if spending more than 344 seconds with this interrupt disabled and then unmasking it.

The right thing to do is to clear the register. This disables the interrupt from happening (at least it does on AMD hardware).

LKML-Reference: <[email protected]>

---
 arch/x86/kernel/apic/apic.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/apic/apic.c +1 -1
index dce93d4..4c689f4 100644
@@ -444,7 +444,7 @@ static void lapic_timer_setup(enum clock_event_mode mode,
 		v = apic_read(APIC_LVTT);
 		v |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR);
 		apic_write(APIC_LVTT, v);
-		apic_write(APIC_TMICT, 0xffffffff);
+		apic_write(APIC_TMICT, 0);
 		break;
 	case CLOCK_EVT_MODE_RESUME:
 		/* Nothing to do here */