Skip to content

runtime: inlining in bgsweep leads to livelock #73499

Open
@ArsenySamoylov

Description

@ArsenySamoylov

Go version

go version devel go1.24-3cdf88bffa Thu Nov 7 21:34:06 2024 +0300 linux/arm64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/asamoylov/.cache/go-build'
GOENV='/home/asamoylov/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/asamoylov/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/asamoylov/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/asamoylov/Go/'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/asamoylov/Go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='devel go1.24-3cdf88bffa Thu Nov 7 21:34:06 2024 +0300'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/asamoylov/.config/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build383434801=/tmp/go-build -gno-record-gcc-switches'

What did you do?

When running go1 BinaryTree17 benchmark with PGO using CL#626295 cmd/compile: support multiple levels of inlining using PGO (see TODO in src/cmd/compile/internal/inline/inl.go:892). I encountered deadlock. Here is my original post about this problem issues#69046

Reproducing bug

Remove TODO part from https://go.dev/cl/626295. Complie https://go.dev/play/p/f7HGymVik58 with PGO:

go test -c -o test.out binary_tree_test.go 
taskset -c 0-3 ./test.out -test.bench=. -test.count=50 -test.cpuprofile=test.pprof
# test.count must be high enoug to collect enoug info

go test -c -pgo=test.pprof -o test-pgo.out binary_tree_test.go
taskset -c 0-3 ./test-pgo.out -test.bench=. -test.count=5 # this command freezes around 3rd iteration

What did you see happen?

Deadlock

What did you expect to see?

Happy end, not a deadlock.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions