Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Revert "timecounter(9): Use an ipi barrier on time_...



details:   https://anonhg.NetBSD.org/src/rev/02539775c80c
branches:  trunk
changeset: 377567:02539775c80c
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Jul 17 15:41:05 2023 +0000

description:
Revert "timecounter(9): Use an ipi barrier on time_second/uptime rollover."

Evidently rump doesn't have ipi, so this won't work unless we have an
alternate approach for rump.

diffstat:

 sys/kern/kern_tc.c |  35 ++++++++---------------------------
 1 files changed, 8 insertions(+), 27 deletions(-)

diffs (88 lines):

diff -r e25450ab2709 -r 02539775c80c sys/kern/kern_tc.c
--- a/sys/kern/kern_tc.c        Mon Jul 17 14:20:19 2023 +0000
+++ b/sys/kern/kern_tc.c        Mon Jul 17 15:41:05 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_tc.c,v 1.69 2023/07/17 13:48:14 riastradh Exp $ */
+/* $NetBSD: kern_tc.c,v 1.70 2023/07/17 15:41:05 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 /* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.69 2023/07/17 13:48:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.70 2023/07/17 15:41:05 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
@@ -50,7 +50,6 @@
 
 #include <sys/atomic.h>
 #include <sys/evcnt.h>
-#include <sys/ipi.h>
 #include <sys/kauth.h>
 #include <sys/kernel.h>
 #include <sys/lock.h>
@@ -168,24 +167,6 @@ setrealuptime(time_t second, time_t upti
 
 #else
 
-static void
-nullipi(void *cookie)
-{
-}
-
-/*
- * Issue membar_release on this CPU, and force membar_acquire on all
- * CPUs.
- */
-static void
-ipi_barrier(void)
-{
-       ipi_msg_t msg = { .func = nullipi };
-
-       ipi_broadcast(&msg, /*skip_self*/true);
-       ipi_wait(&msg);
-}
-
 static inline void
 setrealuptime(time_t second, time_t uptime)
 {
@@ -207,10 +188,10 @@ setrealuptime(time_t second, time_t upti
 
        atomic_store_relaxed(&time__second32.hi, 0xffffffff);
        atomic_store_relaxed(&time__uptime32.hi, 0xffffffff);
-       ipi_barrier();
+       membar_producer();
        atomic_store_relaxed(&time__second32.lo, seclo);
        atomic_store_relaxed(&time__uptime32.lo, uplo);
-       ipi_barrier();
+       membar_producer();
        atomic_store_relaxed(&time__second32.hi, sechi);
        atomic_store_relaxed(&time__uptime32.hi, uphi);
 }
@@ -227,9 +208,9 @@ getrealtime(void)
                                break;
                        SPINLOCK_BACKOFF_HOOK;
                }
-               __insn_barrier();
+               membar_consumer();
                lo = atomic_load_relaxed(&time__second32.lo);
-               __insn_barrier();
+               membar_consumer();
        } while (hi != atomic_load_relaxed(&time__second32.hi));
 
        return ((time_t)hi << 32) | lo;
@@ -247,9 +228,9 @@ getuptime(void)
                                break;
                        SPINLOCK_BACKOFF_HOOK;
                }
-               __insn_barrier();
+               membar_consumer();
                lo = atomic_load_relaxed(&time__uptime32.lo);
-               __insn_barrier();
+               membar_consumer();
        } while (hi != atomic_load_relaxed(&time__uptime32.hi));
 
        return ((time_t)hi << 32) | lo;



Home | Main Index | Thread Index | Old Index