Skip to content

internal/trace: preserve syscall ownership when a P is reused - #82674

Open
JakeNesler wants to merge 1 commit into
golang:masterfrom
JakeNesler:fix-syscall-20261028
Open

JakeNesler wants to merge 1 commit into
golang:masterfrom
JakeNesler:fix-syscall-20261028

Conversation

@JakeNesler

@JakeNesler JakeNesler commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Only clear a P's syscall association if it belongs to the returning
goroutine. The P may have been reused for another syscall, whose blocked
time would otherwise be counted as execution.

Fixes #82673

Only delete a syscall's processor association if it still belongs to the
returning goroutine.

A P can be stolen from G1 and reused by G2 for another syscall before G1
returns. Clearing G1's state currently removes G2's association too,
causing the summarizer to count G2's blocked time as execution.

Add a generated trace and a table test covering both goroutines. For G2,
the fixture reports 256 ns executing and 192 ns blocked, instead of 448
ns executing and no blocked time.

Tests passed on linux/arm64 at 63313a0 with the candidate source
overlay and, for code-generation checks, the rebuilt compiler:

go test -count=3 -overlay=/work/syscall-arm64.json internal/trace/... cmd/trace
go test -race -short -overlay=/work/syscall-arm64.json internal/trace/... cmd/trace

The package tests also passed on linux/amd64. Full all.bash was not run.

CartoGopher tooling for source navigation; reproduction, implementation
and testing with Codex.

Fixes golang#82673
@gopherbot

Copy link
Copy Markdown
Contributor

This PR (HEAD: ae5009b) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/go/+/855641.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to log in to Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

@gopherbot

Copy link
Copy Markdown
Contributor

Message from Michael Knyszek:

Patch Set 2: Code-Review+2


Please don’t reply on this GitHub thread. Visit golang.org/cl/855641.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

Message from Neal Patel:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/855641.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

Message from Jacob Nesler (Jake Nesler):

Patch Set 3:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/855641.
After addressing review feedback, remember to publish your drafts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

internal/trace: overlapping syscalls can misclassify blocked time as execution

2 participants