]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: clear procid in unminit
authorMichael Pratt <mpratt@google.com>
Wed, 6 Sep 2023 14:31:32 +0000 (10:31 -0400)
committerGopher Robot <gobot@golang.org>
Wed, 6 Sep 2023 18:36:02 +0000 (18:36 +0000)
Extra Ms can move between system threads. needm will reinitialize procid
(via minit) on the new thread, but leaving a stale procid behind after
dropm can be misleading if printing the M early in needm for debugging.

Change-Id: I668891971a0baeab31170d1e40a97126416e7379
Reviewed-on: https://go-review.googlesource.com/c/go/+/526118
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/runtime/os3_solaris.go
src/runtime/os_aix.go
src/runtime/os_darwin.go
src/runtime/os_dragonfly.go
src/runtime/os_freebsd.go
src/runtime/os_linux.go
src/runtime/os_netbsd.go
src/runtime/os_openbsd.go
src/runtime/os_windows.go

index 83acc648bbb6223c21b04c14e944b1b585b1f469..81629f02a22674218eeac2780c39671ec9d5adbe 100644 (file)
@@ -231,6 +231,7 @@ func minit() {
 // Called from dropm to undo the effect of an minit.
 func unminit() {
        unminitSignals()
+       getg().m.procid = 0
 }
 
 // Called from exitm, but not from drop, to undo the effect of thread-owned
index ce2d719d0bf2e91325c4b2adc797dc099115d0c8..b26922c908edde8cb6bf81cf34292836a85cdb43 100644 (file)
@@ -183,6 +183,7 @@ func minit() {
 
 func unminit() {
        unminitSignals()
+       getg().m.procid = 0
 }
 
 // Called from exitm, but not from drop, to undo the effect of thread-owned
index be2909532935969649b29d45a854d68cae7b6a0d..ff33db084b0250fcfe69ac7c57a5a3d9a1f670ed 100644 (file)
@@ -344,6 +344,7 @@ func unminit() {
        if !(GOOS == "ios" && GOARCH == "arm64") {
                unminitSignals()
        }
+       getg().m.procid = 0
 }
 
 // Called from exitm, but not from drop, to undo the effect of thread-owned
index 8268c7f0fc618c934530390e3e5df2c39a051447..80c1267765caf2a1041875cbb6e1b9bf3fd48d46 100644 (file)
@@ -211,6 +211,7 @@ func minit() {
 //go:nosplit
 func unminit() {
        unminitSignals()
+       getg().m.procid = 0
 }
 
 // Called from exitm, but not from drop, to undo the effect of thread-owned
index 3af234e279fca9a058647b89ca82701aa2d895d3..ba609c0acc96e659572666cbce10d8e30d8e1cc2 100644 (file)
@@ -328,6 +328,7 @@ func minit() {
 //go:nosplit
 func unminit() {
        unminitSignals()
+       getg().m.procid = 0
 }
 
 // Called from exitm, but not from drop, to undo the effect of thread-owned
index 0b0561039fa25a787423ee396a1ae9c47185985f..51fedba2b874279de02dcd391be07f1016e901a0 100644 (file)
@@ -420,6 +420,7 @@ func minit() {
 //go:nosplit
 func unminit() {
        unminitSignals()
+       getg().m.procid = 0
 }
 
 // Called from exitm, but not from drop, to undo the effect of thread-owned
index b50ed4b69ef824a707874e5cb57632058d8d2127..c5d7b4b978c8d067795fd7bbd4770d2bb39c0c24 100644 (file)
@@ -316,6 +316,7 @@ func minit() {
 //go:nosplit
 func unminit() {
        unminitSignals()
+       getg().m.procid = 0
 }
 
 // Called from exitm, but not from drop, to undo the effect of thread-owned
index 500286ab985038801bf963dd78b5d456855d2abf..dd7436885da809ff24d62f3657346a105a0824c4 100644 (file)
@@ -187,6 +187,7 @@ func minit() {
 //go:nosplit
 func unminit() {
        unminitSignals()
+       getg().m.procid = 0
 }
 
 // Called from exitm, but not from drop, to undo the effect of thread-owned
index 081a4a23d04b3eda372f70ad878efae9f93cd5a6..a4d902d0835e07cd7150969d2fd223ba0cb7cd8a 100644 (file)
@@ -1010,6 +1010,8 @@ func unminit() {
                mp.thread = 0
        }
        unlock(&mp.threadLock)
+
+       mp.procid = 0
 }
 
 // Called from exitm, but not from drop, to undo the effect of thread-owned