]> Cypherpunks repositories - gostls13.git/commit
runtime: invalid negative frequency while tracing
authorMeng Zhuo <mzh@golangcn.org>
Fri, 17 Dec 2021 06:15:42 +0000 (14:15 +0800)
committerZhuo Meng <mzh@golangcn.org>
Wed, 29 Dec 2021 01:44:55 +0000 (01:44 +0000)
commita78532a4121d26c33ee3ce69b3dda3a608f5a077
tree047376ea52fb4ac706016f48714c3de333067f29
parentb357b05b70d2b8c4988ac2a27f2af176e7a09e1b
runtime: invalid negative frequency while tracing

The riscv64 Hifive Unmatched is the only platform that
failed on testcase TestAnalyzeAnnotations occasionally
after CL 332954 had merged. The failure happens when
ticks per second (freq) is over 1e12 which causing the timestamps
of two events are same.

There are 2 reasons causing big frequency:
1. RDCYCLE is HART based according to the riscv manual which makes
   negative ticks delta
2. negative float64 -> uint64 is undefined and "lucky" negative float
   is too big to handle for trace

For #46737

Change-Id: I1f3c1ac31aae249969000c719c32aaf5a66d29a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/373034
Trust: Zhuo Meng <mzh@golangcn.org>
Run-TryBot: Zhuo Meng <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/runtime/asm_riscv64.s
src/runtime/trace.go