On Sat, Oct 07, 2017 at 10:27 +0000, Adam Steen wrote: > On Sat, Oct 7, 2017 at 5:52 PM, Adam Steen <a...@adamsteen.com.au> wrote: > > > On Fri, Oct 06, 2017 at 03:58:18PM +0200, Mike Belopuhov wrote: > > > Hi, > > > > > > An experimental change to use TSC as a timecounter source on a variety > > > of modern Intel and AMD CPUs has been just committed and enabled on > > > OpenBSD/amd64 thanks to the work done by Adam Steen. > > > > > > The rationale is, quoting the commit message: > > > > > > If frequency of an invariant (non-stop) time stamp counter is measured > > > using an independent working timecounter that has a known frequency, we > > > can assume that the measured TSC frequency is as good as the resolution > > > of the timecounter that we use to perform the measurement. This lets us > > > switch from this high quality but expensive source to the cheaper TSC > > > without sacrificing precision on a wide range of modern CPUs. > > > > > > You can query and change the current timecounter source in the runtime > > > via sysctl: > > > > > > % sysctl kern.timecounter.{choice,hardware} > > > kern.timecounter.choice=i8254(0) tsc(2000) acpihpet0(1000) > > acpitimer0(1000) dummy(-1000000) > > > kern.timecounter.hardware=tsc > > > > > > Please make sure your NTP drift (/var/db/ntpd.drift) stays within > > -20..+20 > > > or at least is not worse than it is right now. > > > > > > And finally, please make sure to run a "make config" when building the > > > kernel to update offset tables because of the cpu_info structure changes. > > > > > > Regards, > > > Mike > > > > > > > Hi, > > > > Now that we have an accurate tsc frequency, I would like to expose this > > information to userland via a sysctl. > > > > The diff below exposes the tsc frequency and if it is invariant. > > > > Cheers, > > Adam > > > > > Please ignore that diff, looks like i had some dregs from a older diff i > had been testing
Yeah, I've renamed a few things and deliberately skipped the sysctl part so that we can test for regressions and don't mess with exposed interfaces if we need to back out. So I'd wait a few weeks for people to get it running on a variety of systems and report the fallout if any.