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_delay(): use tsc_freq in preference to ...



details:   https://anonhg.NetBSD.org/src/rev/bf567b2ec236
branches:  trunk
changeset: 972487:bf567b2ec236
user:      ad <ad%NetBSD.org@localhost>
date:      Wed May 27 18:46:15 2020 +0000

description:
tsc_delay(): use tsc_freq in preference to cpu_frequency().

diffstat:

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

diffs (36 lines):

diff -r 11704799ac71 -r bf567b2ec236 sys/arch/x86/x86/tsc.c
--- a/sys/arch/x86/x86/tsc.c    Wed May 27 18:26:29 2020 +0000
+++ b/sys/arch/x86/x86/tsc.c    Wed May 27 18:46:15 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tsc.c,v 1.47 2020/05/20 20:19:02 ad Exp $      */
+/*     $NetBSD: tsc.c,v 1.48 2020/05/27 18:46:15 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.47 2020/05/20 20:19:02 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.48 2020/05/27 18:46:15 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -55,7 +55,7 @@
 static void    tsc_delay(unsigned int);
 
 static uint64_t        tsc_dummy_cacheline __cacheline_aligned;
-uint64_t       tsc_freq; /* exported for sysctl */
+uint64_t       tsc_freq __read_mostly; /* exported for sysctl */
 static int64_t tsc_drift_max = 1000;   /* max cycles */
 static int64_t tsc_drift_observed;
 
@@ -346,7 +346,7 @@
        uint64_t start, delta;
 
        start = cpu_counter();
-       delta = (uint64_t)us * cpu_frequency(&cpu_info_primary) / 1000000;
+       delta = (uint64_t)us * tsc_freq / 1000000;
 
        while ((cpu_counter() - start) < delta) {
                x86_pause();



Home | Main Index | Thread Index | Old Index