From 2d83b646d677ceb3df2ea592b7938efe8214c52a Mon Sep 17 00:00:00 2001 From: Nick Ripley Date: Mon, 1 May 2023 09:08:01 -0400 Subject: [PATCH] runtime/trace: enable frame pointer unwinding by default for amd64 and arm64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Re-enable frame pointer unwinding for execution tracing on amd64 by default, now that CL 489015 and CL 488755 have fixed recently-discovered crashes. This reverts CL 486382. These fixes, together with CL 241158 to fix up frame pointers when copying stacks on arm64, also make frame pointer unwinding for tracing safe to enable for arm64. This should significantly reduce the CPU and latency overhead of execution tracing on arm64, as it has for amd64. Co-Authored-By: Felix Geisendörfer Change-Id: I64a88bd69dfd8cb13956ec46f8b1203dbeaa26a6 Reviewed-on: https://go-review.googlesource.com/c/go/+/490815 Reviewed-by: Felix Geisendörfer Run-TryBot: Nick Ripley Reviewed-by: Michael Knyszek TryBot-Result: Gopher Robot Reviewed-by: Michael Pratt Auto-Submit: Michael Pratt --- src/runtime/runtime1.go | 1 - src/runtime/trace.go | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go index 7dc65bdcc1..65bed433c3 100644 --- a/src/runtime/runtime1.go +++ b/src/runtime/runtime1.go @@ -369,7 +369,6 @@ func parsedebugvars() { debug.cgocheck = 1 debug.invalidptr = 1 debug.adaptivestackstart = 1 // set this to 0 to turn larger initial goroutine stacks off - debug.tracefpunwindoff = 1 // Frame pointer unwinding sometimes crashes on amd64. See issue 59692. if GOOS == "linux" { // On Linux, MADV_FREE is faster than MADV_DONTNEED, // but doesn't affect many of the statistics that diff --git a/src/runtime/trace.go b/src/runtime/trace.go index 79ccebb4b3..5eb68271d1 100644 --- a/src/runtime/trace.go +++ b/src/runtime/trace.go @@ -927,12 +927,10 @@ func traceStackID(mp *m, pcBuf []uintptr, skip int) uint64 { return uint64(id) } -// tracefpunwindoff returns false if frame pointer unwinding for the tracer is +// tracefpunwindoff returns true if frame pointer unwinding for the tracer is // disabled via GODEBUG or not supported by the architecture. func tracefpunwindoff() bool { - // compiler emits frame pointers for amd64 and arm64, but issue 58432 blocks - // arm64 support for now. - return debug.tracefpunwindoff != 0 || goarch.ArchFamily != goarch.AMD64 + return debug.tracefpunwindoff != 0 || (goarch.ArchFamily != goarch.AMD64 && goarch.ArchFamily != goarch.ARM64) } // fpTracebackPCs populates pcBuf with the return addresses for each frame and -- 2.50.0