amd64: lapic_timer_trigger: disable interrupts while configuring timer
authorcheloha <cheloha@openbsd.org>
Tue, 31 Jan 2023 19:11:47 +0000 (19:11 +0000)
committercheloha <cheloha@openbsd.org>
Tue, 31 Jan 2023 19:11:47 +0000 (19:11 +0000)
lapic_timer_oneshot() does three writes.  We need to disable
interrupts to ensure the timer lands in a valid state.

Link: https://marc.info/?l=openbsd-tech&m=167482851403841&w=2
ok mlarkin@

sys/arch/amd64/amd64/lapic.c

index 1be0bf1..6c8ccdf 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: lapic.c,v 1.65 2022/11/10 08:26:54 jmatthew Exp $     */
+/*     $OpenBSD: lapic.c,v 1.66 2023/01/31 19:11:47 cheloha Exp $      */
 /* $NetBSD: lapic.c,v 1.2 2003/05/08 01:04:35 fvdl Exp $ */
 
 /*-
@@ -437,7 +437,11 @@ lapic_timer_rearm(void *unused, uint64_t nsecs)
 void
 lapic_timer_trigger(void *unused)
 {
+       u_long s;
+
+       s = intr_disable();
        lapic_timer_oneshot(0, 1);
+       intr_restore(s);
 }
 
 /*