Skip to content

Commit 3cc590b

Browse files
committed
Merge: x86/apic: Always explicitly disarm TSC-deadline timer
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5951 JIRA: https://issues.redhat.com/browse/RHEL-65750 Signed-off-by: David Arcari <[email protected]> Approved-by: Tony Camuso <[email protected]> Approved-by: Steve Best <[email protected]> Approved-by: CKI KWF Bot <[email protected]> Merged-by: Rado Vrbovsky <[email protected]>
2 parents 96ff072 + 3357674 commit 3cc590b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

arch/x86/kernel/apic/apic.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,19 @@ static int lapic_timer_shutdown(struct clock_event_device *evt)
440440
v = apic_read(APIC_LVTT);
441441
v |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR);
442442
apic_write(APIC_LVTT, v);
443-
apic_write(APIC_TMICT, 0);
443+
444+
/*
445+
* Setting APIC_LVT_MASKED (above) should be enough to tell
446+
* the hardware that this timer will never fire. But AMD
447+
* erratum 411 and some Intel CPU behavior circa 2024 say
448+
* otherwise. Time for belt and suspenders programming: mask
449+
* the timer _and_ zero the counter registers:
450+
*/
451+
if (v & APIC_LVT_TIMER_TSCDEADLINE)
452+
wrmsrl(MSR_IA32_TSC_DEADLINE, 0);
453+
else
454+
apic_write(APIC_TMICT, 0);
455+
444456
return 0;
445457
}
446458

0 commit comments

Comments
 (0)