Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/arch/xen/xen Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/e722639361c6
branches:  netbsd-9
changeset: 378218:e722639361c6
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Jul 27 16:55:41 2023 +0000

description:
Pull up following revision(s) (requested by bouyer in ticket #1668):

        sys/arch/xen/xen/xen_clock.c: revision 1.10
        sys/arch/xen/xen/xen_clock.c: revision 1.12
        (applied to sys/arch/xen/xen/clock.c)

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

diffstat:

 sys/arch/xen/xen/clock.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (39 lines):

diff -r a95d45b75327 -r e722639361c6 sys/arch/xen/xen/clock.c
--- a/sys/arch/xen/xen/clock.c  Thu Jul 27 16:40:50 2023 +0000
+++ b/sys/arch/xen/xen/clock.c  Thu Jul 27 16:55:41 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock.c,v 1.78 2019/03/09 09:51:29 kre Exp $   */
+/*     $NetBSD: clock.c,v 1.78.4.1 2023/07/27 16:55:41 martin Exp $    */
 
 /*-
  * Copyright (c) 2017, 2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.78 2019/03/09 09:51:29 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.78.4.1 2023/07/27 16:55:41 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -769,7 +769,6 @@ xen_resumeclocks(struct cpu_info *ci)
        if (ci->ci_xen_timer_intrhand == NULL)
                panic("failed to establish timer interrupt handler");
 
-       hypervisor_unmask_event(evtch);
 
        aprint_verbose("Xen %s: using event channel %d\n", intr_xname, evtch);
 
@@ -783,10 +782,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());



Home | Main Index | Thread Index | Old Index