Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Apr 2011 20:12:38 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        FreeBSD current <freebsd-current@FreeBSD.org>
Subject:   prefer tsc timecounter when it's good
Message-ID:  <4D9DF086.9020906@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

Guys,

what do you think about the following change?
The idea is mark TSC as the best timecounter when it's invariant and synchronized
between cores.
Unfortunately I don't have code to auto-detect the synchronization and keep
relying on the corresponding tunable.  I thought about auto-setting it for
single-package configurations, but even that information is currently not trivial
to get out of our mp (i386/amd64) machdep code.

--- a/sys/x86/x86/tsc.c
+++ b/sys/x86/x86/tsc.c
@@ -169,6 +169,9 @@ init_TSC_tc(void)
 			printf("TSC timecounter disabled: APM enabled.\n");
 	}

+	if (tsc_is_invariant)
+		tsc_timecounter.tc_quality = 1200;
+
 #ifdef SMP
 	/*
 	 * We can not use the TSC in SMP mode unless the TSCs on all CPUs

-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D9DF086.9020906>