]> Cypherpunks repositories - gostls13.git/commit
runtime: fix cputicks on x86
authorDmitry Vyukov <dvyukov@google.com>
Tue, 17 Feb 2015 11:25:49 +0000 (14:25 +0300)
committerDmitry Vyukov <dvyukov@google.com>
Fri, 20 Feb 2015 16:52:13 +0000 (16:52 +0000)
commit6e70fddec0e1d4a43ffb450f555dde82ff313397
tree98a56d25b0af2800f77748e67a919859faa15f12
parent5868ce3519313dfa60dbc9192bf6b701b25bd4ca
runtime: fix cputicks on x86

See the following issue for context:
https://github.com/golang/go/issues/9729#issuecomment-74648287
In short, RDTSC can produce skewed results without preceding LFENCE/MFENCE.
Information on this matter is very scrappy in the internet.
But this is what linux kernel does (see rdtsc_barrier).
It also fixes the test program on my machine.

Update #9729

Change-Id: I3c1ffbf129fdfdd388bd5b7911b392b319248e68
Reviewed-on: https://go-review.googlesource.com/5033
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/asm_386.s
src/runtime/asm_amd64.s
src/runtime/runtime1.go
src/runtime/runtime2.go