diff options
author | 2019-06-06 19:43:35 +0000 | |
---|---|---|
committer | 2019-06-06 19:43:35 +0000 | |
commit | b77fe90e8dc83a3620bc857e36a3ecba980732c9 (patch) | |
tree | a1542fd4eaf55475b2de7148a9096d371a0b91f1 | |
parent | tweak previous; (diff) | |
download | wireguard-openbsd-b77fe90e8dc83a3620bc857e36a3ecba980732c9.tar.xz wireguard-openbsd-b77fe90e8dc83a3620bc857e36a3ecba980732c9.zip |
Stop promoting the TSC as a high quality timecounter on MULTIPROCESSOR
systems. There is no guarantee that the TSCs on different cores are
synchronized when the OpenBSD kernel boots and we don't have code to
synchronize them ourselves. This affects both AMD and Intel CPUs and
even cores on the same socket can by out of sync.
ok deraadt@, sthen@
-rw-r--r-- | sys/arch/amd64/amd64/tsc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/tsc.c b/sys/arch/amd64/amd64/tsc.c index e799240e799..0c06f4f7cd2 100644 --- a/sys/arch/amd64/amd64/tsc.c +++ b/sys/arch/amd64/amd64/tsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsc.c,v 1.10 2018/07/27 21:11:31 kettenis Exp $ */ +/* $OpenBSD: tsc.c,v 1.11 2019/06/06 19:43:35 kettenis Exp $ */ /* * Copyright (c) 2016,2017 Reyk Floeter <reyk@openbsd.org> * Copyright (c) 2017 Adam Steen <adam@adamsteen.com.au> @@ -172,8 +172,10 @@ calibrate_tsc_freq(void) return; tsc_frequency = freq; tsc_timecounter.tc_frequency = freq; +#ifndef MULTIPROCESSOR if (tsc_is_invariant) tsc_timecounter.tc_quality = 2000; +#endif } void @@ -209,7 +211,9 @@ tsc_timecounter_init(struct cpu_info *ci, uint64_t cpufreq) /* Newer CPUs don't require recalibration */ if (tsc_frequency > 0) { tsc_timecounter.tc_frequency = tsc_frequency; +#ifndef MULTIPROCESSOR tsc_timecounter.tc_quality = 2000; +#endif } else { tsc_recalibrate = 1; tsc_frequency = cpufreq; |