summaryrefslogtreecommitdiffstats
path: root/sys/cddl/dev/dtrace
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2011-04-07 23:28:28 +0000
committerjkim <jkim@FreeBSD.org>2011-04-07 23:28:28 +0000
commit95c723445e6a8035e5b4b318941c66ac674cd16c (patch)
tree664d6632a866948517ff612d5ccfb37cd5bf91db /sys/cddl/dev/dtrace
parent824b228f1c496d62e28a46c5b32fbd974d60a42e (diff)
downloadFreeBSD-src-95c723445e6a8035e5b4b318941c66ac674cd16c.zip
FreeBSD-src-95c723445e6a8035e5b4b318941c66ac674cd16c.tar.gz
Use atomic load & store for TSC frequency. It may be overkill for amd64 but
safer for i386 because it can be easily over 4 GHz now. More worse, it can be easily changed by user with 'machdep.tsc_freq' tunable (directly) or cpufreq(4) (indirectly). Note it is intentionally not used in performance critical paths to avoid performance regression (but we should, in theory). Alternatively, we may add "virtual TSC" with lower frequency if maximum frequency overflows 32 bits (and ignore possible incoherency as we do now).
Diffstat (limited to 'sys/cddl/dev/dtrace')
-rw-r--r--sys/cddl/dev/dtrace/amd64/dtrace_subr.c2
-rw-r--r--sys/cddl/dev/dtrace/i386/dtrace_subr.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/cddl/dev/dtrace/amd64/dtrace_subr.c b/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
index 52da1b7..102ea04 100644
--- a/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
+++ b/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
@@ -403,7 +403,7 @@ dtrace_gethrtime_init(void *arg)
* Otherwise tick->time conversion will be inaccurate, but
* will preserve monotonic property of TSC.
*/
- tsc_f = tsc_freq;
+ tsc_f = atomic_load_acq_64(&tsc_freq);
/*
* The following line checks that nsec_scale calculated below
diff --git a/sys/cddl/dev/dtrace/i386/dtrace_subr.c b/sys/cddl/dev/dtrace/i386/dtrace_subr.c
index c5ea277..50793c4 100644
--- a/sys/cddl/dev/dtrace/i386/dtrace_subr.c
+++ b/sys/cddl/dev/dtrace/i386/dtrace_subr.c
@@ -403,7 +403,7 @@ dtrace_gethrtime_init(void *arg)
* Otherwise tick->time conversion will be inaccurate, but
* will preserve monotonic property of TSC.
*/
- tsc_f = tsc_freq;
+ tsc_f = atomic_load_acq_64(&tsc_freq);
/*
* The following line checks that nsec_scale calculated below
OpenPOWER on IntegriCloud