aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/trace2stack.go
diff options
context:
space:
mode:
authorMichael Knyszek <mknyszek@google.com>2024-04-08 21:34:24 +0000
committerGopher Robot <gobot@golang.org>2024-04-08 21:58:49 +0000
commit9f13665088012298146c573bc2a7255b1caf2750 (patch)
tree4f80ef5b0a15e668118c6d912f98c52958281d89 /src/runtime/trace2stack.go
parente995aa95cb5f379c1df5d5511ee09970261d877f (diff)
downloadgo-9f13665088012298146c573bc2a7255b1caf2750.tar.xz
Revert "runtime: push down systemstack requirement for tracer where possible"
This reverts CL 572095. Reason for revert: Broke longtest builders. Change-Id: Iac3a8159d3afb4156a49c7d6819cdd15fe9d4bbb Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/577376 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Diffstat (limited to 'src/runtime/trace2stack.go')
-rw-r--r--src/runtime/trace2stack.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/runtime/trace2stack.go b/src/runtime/trace2stack.go
index 7d698c89d3..4ee3b32b05 100644
--- a/src/runtime/trace2stack.go
+++ b/src/runtime/trace2stack.go
@@ -138,6 +138,11 @@ func (t *traceStackTable) put(pcs []uintptr) uint64 {
// dump writes all previously cached stacks to trace buffers,
// releases all memory and resets state. It must only be called once the caller
// can guarantee that there are no more writers to the table.
+//
+// This must run on the system stack because it flushes buffers and thus
+// may acquire trace.lock.
+//
+//go:systemstack
func (t *traceStackTable) dump(gen uintptr) {
w := unsafeTraceWriter(gen, nil)
@@ -189,11 +194,9 @@ func (t *traceStackTable) dump(gen uintptr) {
}
// Still, hold the lock over reset. The callee expects it, even though it's
// not strictly necessary.
- systemstack(func() {
- lock(&t.tab.lock)
- t.tab.reset()
- unlock(&t.tab.lock)
- })
+ lock(&t.tab.lock)
+ t.tab.reset()
+ unlock(&t.tab.lock)
w.flush().end()
}