Module Name: src Committed By: martin Date: Wed Jul 19 14:31:40 UTC 2023
Modified Files: src/sys/arch/xen/xen [netbsd-10]: xen_clock.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #238): sys/arch/xen/xen/xen_clock.c: revision 1.10 sys/arch/xen/xen/xen_clock.c: revision 1.12 Unmask event after VCPUOP_stop_periodic_timer and initializing ci->ci_xen_hardclock_systime_ns, to avoid a possible race with xen_timer_handler() 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 To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.8.18.1 src/sys/arch/xen/xen/xen_clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/xen/xen/xen_clock.c diff -u src/sys/arch/xen/xen/xen_clock.c:1.8 src/sys/arch/xen/xen/xen_clock.c:1.8.18.1 --- src/sys/arch/xen/xen/xen_clock.c:1.8 Mon Nov 30 17:05:02 2020 +++ src/sys/arch/xen/xen/xen_clock.c Wed Jul 19 14:31:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: xen_clock.c,v 1.8 2020/11/30 17:05:02 bouyer Exp $ */ +/* $NetBSD: xen_clock.c,v 1.8.18.1 2023/07/19 14:31:40 martin 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.8 2020/11/30 17:05:02 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_clock.c,v 1.8.18.1 2023/07/19 14:31:40 martin Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -639,7 +639,6 @@ xen_resumeclocks(struct cpu_info *ci) ci, IPL_CLOCK, NULL, intr_xname, true, ci) == NULL) panic("failed to establish timer interrupt handler"); - hypervisor_unmask_event(evtch); aprint_verbose("Xen %s: using event channel %d\n", intr_xname, evtch); @@ -653,10 +652,12 @@ xen_resumeclocks(struct cpu_info *ci) /* Pretend the last hardclock happened right now. */ ci->ci_xen_hardclock_systime_ns = xen_vcputime_systime_ns(); + /* 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());