Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 tsc_get_timecount(): disable the "clock goe...



details:   https://anonhg.NetBSD.org/src/rev/146aa8c70fd4
branches:  trunk
changeset: 972980:146aa8c70fd4
user:      ad <ad%NetBSD.org@localhost>
date:      Sun Jun 14 23:24:20 2020 +0000

description:
tsc_get_timecount(): disable the "clock goes backwards" check on i386 for
the moment since it requires 64-bit store to be atomic because of nesting
via interrupt.

diffstat:

 sys/arch/x86/x86/tsc.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r d808f88934f7 -r 146aa8c70fd4 sys/arch/x86/x86/tsc.c
--- a/sys/arch/x86/x86/tsc.c    Sun Jun 14 23:23:55 2020 +0000
+++ b/sys/arch/x86/x86/tsc.c    Sun Jun 14 23:24:20 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tsc.c,v 1.49 2020/06/13 23:58:52 ad Exp $      */
+/*     $NetBSD: tsc.c,v 1.50 2020/06/14 23:24:20 ad Exp $      */
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.49 2020/06/13 23:58:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.50 2020/06/14 23:24:20 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -357,6 +357,7 @@
 static u_int
 tsc_get_timecount(struct timecounter *tc)
 {
+#ifdef _LP64 /* requires atomic 64-bit store */
        static __cpu_simple_lock_t lock = __SIMPLELOCK_UNLOCKED;
        static int lastwarn;
        uint64_t cur, prev;
@@ -385,4 +386,7 @@
        }
        l->l_md.md_tsc = cur;
        return (uint32_t)cur;
+#else
+       return cpu_counter32();
+#endif
 }



Home | Main Index | Thread Index | Old Index