Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/xen Unmask event after arming the one-shot time...



details:   https://anonhg.NetBSD.org/src/rev/a875c7fd4139
branches:  trunk
changeset: 377552:a875c7fd4139
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon Jul 17 10:12:54 2023 +0000

description:
Unmask event after arming the one-shot timer in clock initialisation,
to avoid a possible race with xen_timer_handler() updating
ci_xen_hardclock_systime_ns while we're reading it.
Pointed out by Taylor R Campbell

diffstat:

 sys/arch/xen/xen/xen_clock.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 41cf1e33837d -r a875c7fd4139 sys/arch/xen/xen/xen_clock.c
--- a/sys/arch/xen/xen/xen_clock.c      Mon Jul 17 04:24:34 2023 +0000
+++ b/sys/arch/xen/xen/xen_clock.c      Mon Jul 17 10:12:54 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xen_clock.c,v 1.11 2023/07/13 13:34:15 riastradh Exp $ */
+/*     $NetBSD: xen_clock.c,v 1.12 2023/07/17 10:12:54 bouyer Exp $    */
 
 /*-
  * Copyright (c) 2017, 2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_clock.c,v 1.11 2023/07/13 13:34:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_clock.c,v 1.12 2023/07/17 10:12:54 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -729,12 +729,12 @@ xen_resumeclocks(struct cpu_info *ci)
        /* Pretend the last hardclock happened right now.  */
        ci->ci_xen_hardclock_systime_ns = xen_vcputime_systime_ns();
 
-       hypervisor_unmask_event(evtch);
 
        /* Arm the one-shot timer.  */
        error = HYPERVISOR_set_timer_op(ci->ci_xen_hardclock_systime_ns +
            NS_PER_TICK);
        KASSERT(error == 0);
+       hypervisor_unmask_event(evtch);
 
        /* We'd better not have switched CPUs.  */
        KASSERT(ci == curcpu());



Home | Main Index | Thread Index | Old Index