Skip to content

Commit c72a2ba

Browse files
panjf2000gopherbot
authored andcommitted
[release-branch.go1.23] runtime: explicitly disable async preempt for internal/runtime
Fixes #72114 For #71591 Relevant CL 560155 Change-Id: Iebc497d56b36d50c13a6dd88e7bca4578a03cf63 Reviewed-on: https://go-review.googlesource.com/c/go/+/654916 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Auto-Submit: Michael Pratt <[email protected]> Reviewed-by: Michael Pratt <[email protected]> (cherry picked from commit 92a63bd) Reviewed-on: https://go-review.googlesource.com/c/go/+/660935 Auto-Submit: Dmitri Shuralyov <[email protected]>
1 parent 2c0a0fc commit c72a2ba

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/cmd/internal/objabi/pkgspecial.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ type PkgSpecial struct {
4343
}
4444

4545
var runtimePkgs = []string{
46+
// TODO(panjf2000): consider syncing the list inside the
47+
// isAsyncSafePoint in preempt.go based on this list?
48+
4649
"runtime",
4750

4851
"internal/runtime/atomic",

src/runtime/preempt.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,14 +419,21 @@ func isAsyncSafePoint(gp *g, pc, sp, lr uintptr) (bool, uintptr) {
419419
name := u.srcFunc(uf).name()
420420
if stringslite.HasPrefix(name, "runtime.") ||
421421
stringslite.HasPrefix(name, "runtime/internal/") ||
422+
stringslite.HasPrefix(name, "internal/runtime/") ||
422423
stringslite.HasPrefix(name, "reflect.") {
423424
// For now we never async preempt the runtime or
424425
// anything closely tied to the runtime. Known issues
425426
// include: various points in the scheduler ("don't
426427
// preempt between here and here"), much of the defer
427428
// implementation (untyped info on stack), bulk write
428-
// barriers (write barrier check),
429-
// reflect.{makeFuncStub,methodValueCall}.
429+
// barriers (write barrier check), atomic functions in
430+
// internal/runtime/atomic, reflect.{makeFuncStub,methodValueCall}.
431+
//
432+
// Note that this is a subset of the runtimePkgs in pkgspecial.go
433+
// and these checks are theoretically redundant because the compiler
434+
// marks "all points" in runtime functions as unsafe for async preemption.
435+
// But for some reason, we can't eliminate these checks until https://go.dev/issue/72031
436+
// is resolved.
430437
//
431438
// TODO(austin): We should improve this, or opt things
432439
// in incrementally.

0 commit comments

Comments
 (0)