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 VCPUOP_stop_periodic_tim...



details:   https://anonhg.NetBSD.org/src/rev/72a6deea7493
branches:  trunk
changeset: 377326:72a6deea7493
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Fri Jul 07 15:13:41 2023 +0000

description:
Unmask event after VCPUOP_stop_periodic_timer and
initializing ci->ci_xen_hardclock_systime_ns, to avoid a possible race with
xen_timer_handler()

diffstat:

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

diffs (35 lines):

diff -r 17a6d20ee9ef -r 72a6deea7493 sys/arch/xen/xen/xen_clock.c
--- a/sys/arch/xen/xen/xen_clock.c      Fri Jul 07 14:05:37 2023 +0000
+++ b/sys/arch/xen/xen/xen_clock.c      Fri Jul 07 15:13:41 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xen_clock.c,v 1.9 2023/05/01 09:03:19 riastradh Exp $  */
+/*     $NetBSD: xen_clock.c,v 1.10 2023/07/07 15:13:41 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.9 2023/05/01 09:03:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_clock.c,v 1.10 2023/07/07 15:13:41 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -700,7 +700,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);
 
@@ -714,6 +713,8 @@ 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);



Home | Main Index | Thread Index | Old Index