From 7ef8dd0b759dda66652c48273961c5405a360b59 Mon Sep 17 00:00:00 2001 From: cheloha Date: Thu, 9 Feb 2023 01:41:15 +0000 Subject: [PATCH] i386: lapic_timer_trigger: disable interrupts around lapic_timer_oneshot() lapic_timer_oneshot() is not atomic. We need to disable interrupts when calling it to ensure the timer reaches a valid state. Link: https://marc.info/?l=openbsd-tech&m=167482851403841&w=2 ok mlarkin@ --- sys/arch/i386/i386/lapic.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/arch/i386/i386/lapic.c b/sys/arch/i386/i386/lapic.c index 3671b31db40..fae8f71cbfc 100644 --- a/sys/arch/i386/i386/lapic.c +++ b/sys/arch/i386/i386/lapic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lapic.c,v 1.54 2023/01/30 10:49:05 jsg Exp $ */ +/* $OpenBSD: lapic.c,v 1.55 2023/02/09 01:41:15 cheloha Exp $ */ /* $NetBSD: lapic.c,v 1.1.2.8 2000/02/23 06:10:50 sommerfeld Exp $ */ /*- @@ -271,7 +271,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); } /* -- 2.20.1