From: Meng Zhuo Date: Wed, 18 Nov 2020 02:28:18 +0000 (+0800) Subject: runtime: check mips64 VDSO clock_gettime return code X-Git-Tag: go1.16rc1~118 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=df81a15819d5b264e6451976a2884953e8d28b20;p=gostls13.git runtime: check mips64 VDSO clock_gettime return code We introduced VDSO feature for mips64x in Go1.14, however Linux kernel didn't ship VDSO safe fallback until 4.13. This CL checks vdso return code it may fix this issue. name old time/op new time/op delta Now 174ns ± 0% 176ns ± 0% +1.20% (p=0.000 n=8+9) NowUnixNano 175ns ± 0% 177ns ± 0% +1.13% (p=0.000 n=9+7) FormatNow 1.01µs ± 1% 1.02µs ± 3% ~ (p=0.181 n=10+10) Fixes #39046 Change-Id: Ibcefe4c8334f634c7ef18fa70f3c7dbe8306f224 Reviewed-on: https://go-review.googlesource.com/c/go/+/270717 Run-TryBot: Meng Zhuo Reviewed-by: Ian Lance Taylor Trust: Michael Pratt Trust: Meng Zhuo --- diff --git a/src/runtime/sys_linux_mips64x.s b/src/runtime/sys_linux_mips64x.s index afad056d06..c3e9f37694 100644 --- a/src/runtime/sys_linux_mips64x.s +++ b/src/runtime/sys_linux_mips64x.s @@ -250,6 +250,14 @@ noswitch: BEQ R25, fallback JAL (R25) + // check on vdso call return for kernel compatibility + // see https://golang.org/issues/39046 + // if we get any error make fallback permanent. + BEQ R2, R0, finish + MOVV R0, runtime·vdsoClockgettimeSym(SB) + MOVW $0, R4 // CLOCK_REALTIME + MOVV $0(R29), R5 + JMP fallback finish: MOVV 0(R29), R3 // sec @@ -311,6 +319,12 @@ noswitch: BEQ R25, fallback JAL (R25) + // see walltime1 for detail + BEQ R2, R0, finish + MOVV R0, runtime·vdsoClockgettimeSym(SB) + MOVW $1, R4 // CLOCK_MONOTONIC + MOVV $0(R29), R5 + JMP fallback finish: MOVV 0(R29), R3 // sec