-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: spurious cycles in time.Now pprof output (vdsoPC and vdsoSP not WAI?) #47324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@cherrymui per owners (I am assuming that this is a runtime/pprof problem). |
I assume this is Linux/ARM64? (from sys_linux_arm64.s in the profile) It appears to me in sys_linux_arm64.s we probably store the wrong value into m.vdsoSP. I think we should store the caller's SP instead of its own SP. I'll work on a fix. (But would still be good to know the information above. Thanks.) |
Sorry, yes, linux/arm64. I’ve also seen it on linux/amd64, and it wouldn’t surprise me if it were also present on other platforms. The reproduction above was with 1.16, I believe. (I’m AFK.) |
Does CL https://go-review.googlesource.com/c/go/+/337590 help? (It's on tip.) Thanks. |
Change https://golang.org/cl/337590 mentions this issue: |
Sure does! |
Thanks. I'll make it a real CL then. |
@cherrymui should we fix other architectures in CL 337590 or submit separate CLs for this issue? |
I'll probably do all of them in one CL. |
Change https://golang.org/cl/380715 mentions this issue: |
Change https://golang.org/cl/380716 mentions this issue: |
m.vdsoSP should be set to the SP of the caller of nanotime1, instead of the SP of nanotime1 itself, which matches m.vdsoPC. Otherwise the unmatched vdsoPC and vdsoSP would make the stack trace look like recursive. We already do it correctly on AMD64, 386, and RISCV64. This CL fixes the rest. Also incorporate CL 352509, skipping a flaky test. Updates #47324, #50772. Fixes #50780. Change-Id: I98b6fcfbe9fc6bdd28b8fe2a1299b7c505371dd4 Reviewed-on: https://go-review.googlesource.com/c/go/+/337590 Trust: Cherry Mui <[email protected]> Trust: Josh Bleecher Snyder <[email protected]> Reviewed-by: Josh Bleecher Snyder <[email protected]> (cherry picked from commit 217507e) Reviewed-on: https://go-review.googlesource.com/c/go/+/380716 Run-TryBot: Cherry Mui <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Michael Knyszek <[email protected]>
m.vdsoSP should be set to the SP of the caller of nanotime1, instead of the SP of nanotime1 itself, which matches m.vdsoPC. Otherwise the unmatched vdsoPC and vdsoSP would make the stack trace look like recursive. We already do it correctly on AMD64, 386, and RISCV64. This CL fixes the rest. Also incorporate CL 352509, skipping a flaky test. Updates #47324, #50772. Fixes #50781. Change-Id: I98b6fcfbe9fc6bdd28b8fe2a1299b7c505371dd4 Reviewed-on: https://go-review.googlesource.com/c/go/+/337590 Trust: Cherry Mui <[email protected]> Trust: Josh Bleecher Snyder <[email protected]> Reviewed-by: Josh Bleecher Snyder <[email protected]> (cherry picked from commit 217507e) Reviewed-on: https://go-review.googlesource.com/c/go/+/380715 Run-TryBot: Cherry Mui <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Michael Knyszek <[email protected]>
On linux:
go test -bench=kNow$ -run=NONE -count=3 -cpuprofile=c.p time
go tool pprof -pdf -lines c.p > o.pdf
Result:
o.pdf
Observe the cycles in the graph. The actual call graph doesn't have any cycles in it.
The text was updated successfully, but these errors were encountered: