summaryrefslogtreecommitdiffstats
path: root/sys/x86
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-01-30 12:43:10 +0000
committerkib <kib@FreeBSD.org>2013-01-30 12:43:10 +0000
commitb19d7b3a7d074dab1d31875d6620e3fe26a41666 (patch)
treeaacafe7d80394de711036d532bbce868a3fa3367 /sys/x86
parentd2c9e405ba3a5efb5fd31f5f0c033cbb3058b2d9 (diff)
downloadFreeBSD-src-b19d7b3a7d074dab1d31875d6620e3fe26a41666.zip
FreeBSD-src-b19d7b3a7d074dab1d31875d6620e3fe26a41666.tar.gz
Reduce default shift used to calculate the max frequency for the TSC
timecounter to 1, and correspondingly increase the precision of the gettimeofday(2) and related functions in the default configuration. The motivation for the TSC-low timecounter, as described in the r222866, seems to provide a workaround for the non-serializing behaviour of the RDTSC on some Intel hardware. Tests demonstrate that even with the pre-shift of 8, the cross-core non-monotonicity of the RDTSC is still observed reliably, e.g. on the Nehalems. The r238755 and r238973 implemented the proper fix for the issue. The pre-shift of 1 is applied to keep TSC not overflowing for the frequency of hardclock down to 2 sec/intr. The pre-shift is made a tunable to allow the easy debugging of the issues users could see with the shift being too low. Reviewed by: bde MFC after: 2 weeks
Diffstat (limited to 'sys/x86')
-rw-r--r--sys/x86/x86/tsc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c
index 04231b8..1714572 100644
--- a/sys/x86/x86/tsc.c
+++ b/sys/x86/x86/tsc.c
@@ -65,6 +65,12 @@ static int smp_tsc;
SYSCTL_INT(_kern_timecounter, OID_AUTO, smp_tsc, CTLFLAG_RDTUN, &smp_tsc, 0,
"Indicates whether the TSC is safe to use in SMP mode");
TUNABLE_INT("kern.timecounter.smp_tsc", &smp_tsc);
+
+static int smp_tsc_shift = 1;
+SYSCTL_INT(_kern_timecounter, OID_AUTO, smp_tsc_shift, CTLFLAG_RDTUN,
+ &smp_tsc_shift, 0,
+ "Shift to pre-apply for the maximum TSC frequency in SMP mode");
+TUNABLE_INT("kern.timecounter.smp_tsc_shift", &smp_tsc_shift);
#endif
static int tsc_disabled;
@@ -506,7 +512,7 @@ init_TSC_tc(void)
tsc_timecounter.tc_quality = -100;
} else {
tsc_timecounter.tc_quality = test_smp_tsc();
- max_freq >>= 8;
+ max_freq >>= smp_tsc_shift;
}
} else
#endif
OpenPOWER on IntegriCloud