[go] runtime,runtime/cgo: port to Go part of the runtime init lock

9 views
Skip to first unread message

Quim Muntal (Gerrit)

unread,
Feb 17, 2026, 10:44:10 AM (8 days ago) Feb 17
to goph...@pubsubhelper.golang.org, Cherry Mui, Michael Pratt, Go LUCI, golang-co...@googlegroups.com
Attention needed from Cherry Mui and Michael Pratt

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Cherry Mui
  • Michael Pratt
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
Gerrit-Change-Number: 745605
Gerrit-PatchSet: 1
Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
Gerrit-Reviewer: Cherry Mui <cher...@google.com>
Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
Gerrit-Attention: Cherry Mui <cher...@google.com>
Gerrit-Attention: Michael Pratt <mpr...@google.com>
Gerrit-Comment-Date: Tue, 17 Feb 2026 15:44:02 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
unsatisfied_requirement
satisfied_requirement
open
diffy

Ian Lance Taylor (Gerrit)

unread,
Feb 18, 2026, 6:59:15 PM (6 days ago) Feb 18
to Quim Muntal, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Cherry Mui, Michael Pratt, Go LUCI, golang-co...@googlegroups.com
Attention needed from Cherry Mui and Quim Muntal

Ian Lance Taylor added 9 comments

File src/cmd/cgo/internal/testcarchive/testdata/libgo11/traceback_c.c
Line 12, Patchset 1 (Latest): arg->context = ++contextCount;
Ian Lance Taylor . unresolved

Let's keep our C code roughly Go like.

    contextCount++;
arg->context = contextCount
Line 14, Patchset 1 (Latest): --contextCount;
Ian Lance Taylor . unresolved

contextCount--;

File src/cmd/cgo/out.go
Line 65, Patchset 1 (Latest): fmt.Fprintf(fm, "size_t _cgo_wait_runtime_init_done(void) { return 0; }\n")
Ian Lance Taylor . unresolved

We should change _cgo_wait_runtime_init_done to not return a value.

File src/runtime/cgo/gcc_libinit.c
Line 38, Patchset 1 (Latest):uintptr_t
Ian Lance Taylor . unresolved

s/uintptr_t/void/

and drop the "return 0;" at the end.

File src/runtime/cgo/gcc_libinit_windows.c
Line 74, Patchset 1 (Latest):uintptr_t
Ian Lance Taylor . unresolved

s/uintptr_t/void

drop return

File src/runtime/cgocall.go
Line 313, Patchset 1 (Latest):func cgocallbackg(fn, frame unsafe.Pointer, ctxt uintptr) {
Ian Lance Taylor . unresolved

I think ctxt will always be zero. We should add a TODO to remove it (which will unfortunately mean editing assembly code for each platform).

Line 410, Patchset 1 (Latest): if !mainInitDone.Load() {
Ian Lance Taylor . unresolved

Update for CL 746581.

Line 420, Patchset 1 (Latest): if ctxt == 0 && cgoContext != nil {
Ian Lance Taylor . unresolved

It seems to me that ctxt will always be 0 at this point. When would it be otherwise?

Line 448, Patchset 1 (Latest): // Decrease the length of the slice by one, safely.
Ian Lance Taylor . unresolved

Since we could get a SIGPROF at any time, we need to shrink the slice _before_ we release the context argument.

Open in Gerrit

Related details

Attention is currently required from:
  • Cherry Mui
  • Quim Muntal
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
    Gerrit-Change-Number: 745605
    Gerrit-PatchSet: 1
    Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
    Gerrit-Reviewer: Cherry Mui <cher...@google.com>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
    Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
    Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
    Gerrit-Attention: Cherry Mui <cher...@google.com>
    Gerrit-Comment-Date: Wed, 18 Feb 2026 23:59:10 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Quim Muntal (Gerrit)

    unread,
    Feb 19, 2026, 4:06:10 AM (6 days ago) Feb 19
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Cherry Mui and Quim Muntal

    Quim Muntal uploaded new patchset

    Quim Muntal uploaded patch set #2 to this change.
    Following approvals got outdated and were removed:
    • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Cherry Mui
    • Quim Muntal
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newpatchset
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
      Gerrit-Change-Number: 745605
      Gerrit-PatchSet: 2
      unsatisfied_requirement
      open
      diffy

      Quim Muntal (Gerrit)

      unread,
      Feb 19, 2026, 4:06:24 AM (6 days ago) Feb 19
      to goph...@pubsubhelper.golang.org, Ian Lance Taylor, Cherry Mui, Michael Pratt, Go LUCI, golang-co...@googlegroups.com
      Attention needed from Cherry Mui and Ian Lance Taylor

      Quim Muntal voted and added 9 comments

      Votes added by Quim Muntal

      Commit-Queue+1

      9 comments

      File src/cmd/cgo/internal/testcarchive/testdata/libgo11/traceback_c.c
      Line 12, Patchset 1: arg->context = ++contextCount;
      Ian Lance Taylor . resolved

      Let's keep our C code roughly Go like.

          contextCount++;
      arg->context = contextCount
      Quim Muntal

      Done

      Line 14, Patchset 1: --contextCount;
      Ian Lance Taylor . resolved

      contextCount--;

      Quim Muntal

      Done

      File src/cmd/cgo/out.go
      Line 65, Patchset 1: fmt.Fprintf(fm, "size_t _cgo_wait_runtime_init_done(void) { return 0; }\n")
      Ian Lance Taylor . resolved

      We should change _cgo_wait_runtime_init_done to not return a value.

      Quim Muntal

      Done

      File src/runtime/cgo/gcc_libinit.c
      Line 38, Patchset 1:uintptr_t
      Ian Lance Taylor . resolved

      s/uintptr_t/void/

      and drop the "return 0;" at the end.

      Quim Muntal

      Done

      File src/runtime/cgo/gcc_libinit_windows.c
      Line 74, Patchset 1:uintptr_t
      Ian Lance Taylor . resolved

      s/uintptr_t/void

      drop return

      Quim Muntal

      Done

      File src/runtime/cgocall.go
      Line 313, Patchset 1:func cgocallbackg(fn, frame unsafe.Pointer, ctxt uintptr) {
      Ian Lance Taylor . resolved

      I think ctxt will always be zero. We should add a TODO to remove it (which will unfortunately mean editing assembly code for each platform).

      Quim Muntal

      Good catch. Will add the TODO and implement it in a follow-up CL.

      Line 410, Patchset 1: if !mainInitDone.Load() {
      Ian Lance Taylor . resolved

      Update for CL 746581.

      Quim Muntal

      Done

      Line 420, Patchset 1: if ctxt == 0 && cgoContext != nil {
      Ian Lance Taylor . resolved

      It seems to me that ctxt will always be 0 at this point. When would it be otherwise?

      Quim Muntal

      Yep. It can only be zero. Removing the check.

      Line 448, Patchset 1: // Decrease the length of the slice by one, safely.
      Ian Lance Taylor . resolved

      Since we could get a SIGPROF at any time, we need to shrink the slice _before_ we release the context argument.

      Quim Muntal

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Cherry Mui
      • Ian Lance Taylor
      Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
        Gerrit-Change-Number: 745605
        Gerrit-PatchSet: 2
        Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
        Gerrit-Reviewer: Cherry Mui <cher...@google.com>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
        Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Cherry Mui <cher...@google.com>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Comment-Date: Thu, 19 Feb 2026 09:06:17 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Comment-In-Reply-To: Ian Lance Taylor <ia...@golang.org>
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Quim Muntal (Gerrit)

        unread,
        Feb 19, 2026, 4:12:58 AM (6 days ago) Feb 19
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Cherry Mui, Ian Lance Taylor and Quim Muntal

        Quim Muntal uploaded new patchset

        Quim Muntal uploaded patch set #3 to this change.
        Following approvals got outdated and were removed:
        • TryBots-Pass: LUCI-TryBot-Result-1 by Go LUCI
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Cherry Mui
        • Ian Lance Taylor
        • Quim Muntal
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
        Gerrit-Change-Number: 745605
        Gerrit-PatchSet: 3
        Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
        Gerrit-Reviewer: Cherry Mui <cher...@google.com>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
        Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Quim Muntal (Gerrit)

        unread,
        Feb 19, 2026, 4:13:08 AM (6 days ago) Feb 19
        to goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, Cherry Mui, Michael Pratt, golang-co...@googlegroups.com
        Attention needed from Cherry Mui and Ian Lance Taylor

        Quim Muntal voted Commit-Queue+1

        Commit-Queue+1
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Cherry Mui
        • Ian Lance Taylor
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
        Gerrit-Change-Number: 745605
        Gerrit-PatchSet: 3
        Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
        Gerrit-Reviewer: Cherry Mui <cher...@google.com>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
        Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Cherry Mui <cher...@google.com>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Comment-Date: Thu, 19 Feb 2026 09:13:02 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Quim Muntal (Gerrit)

        unread,
        Feb 19, 2026, 7:09:16 AM (6 days ago) Feb 19
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Cherry Mui and Ian Lance Taylor

        Quim Muntal uploaded new patchset

        Quim Muntal uploaded patch set #4 to this change.
        Following approvals got outdated and were removed:
        • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Cherry Mui
        • Ian Lance Taylor
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
        Gerrit-Change-Number: 745605
        Gerrit-PatchSet: 4
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Quim Muntal (Gerrit)

        unread,
        Feb 19, 2026, 7:10:00 AM (6 days ago) Feb 19
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Cherry Mui and Ian Lance Taylor

        Quim Muntal uploaded new patchset

        Quim Muntal uploaded patch set #5 to this change.
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Cherry Mui
        • Ian Lance Taylor
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
        Gerrit-Change-Number: 745605
        Gerrit-PatchSet: 5
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Quim Muntal (Gerrit)

        unread,
        Feb 19, 2026, 7:10:21 AM (6 days ago) Feb 19
        to goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, Cherry Mui, Michael Pratt, golang-co...@googlegroups.com
        Attention needed from Cherry Mui and Ian Lance Taylor

        Quim Muntal voted Commit-Queue+1

        Commit-Queue+1
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Cherry Mui
        • Ian Lance Taylor
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
        Gerrit-Change-Number: 745605
        Gerrit-PatchSet: 5
        Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
        Gerrit-Reviewer: Cherry Mui <cher...@google.com>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
        Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Cherry Mui <cher...@google.com>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Comment-Date: Thu, 19 Feb 2026 12:10:15 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Ian Lance Taylor (Gerrit)

        unread,
        Feb 19, 2026, 4:44:25 PM (6 days ago) Feb 19
        to Quim Muntal, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Go LUCI, Cherry Mui, Michael Pratt, golang-co...@googlegroups.com
        Attention needed from Cherry Mui and Quim Muntal

        Ian Lance Taylor voted and added 1 comment

        Votes added by Ian Lance Taylor

        Code-Review+2

        1 comment

        Patchset-level comments
        Ian Lance Taylor . resolved

        Thanks.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Cherry Mui
        • Quim Muntal
        Submit Requirements:
        • requirement satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
        Gerrit-Change-Number: 745605
        Gerrit-PatchSet: 5
        Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
        Gerrit-Reviewer: Cherry Mui <cher...@google.com>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
        Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Cherry Mui <cher...@google.com>
        Gerrit-Comment-Date: Thu, 19 Feb 2026 21:44:21 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Cherry Mui (Gerrit)

        unread,
        Feb 19, 2026, 6:27:13 PM (5 days ago) Feb 19
        to Quim Muntal, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Go LUCI, Michael Pratt, golang-co...@googlegroups.com
        Attention needed from Quim Muntal

        Cherry Mui voted and added 1 comment

        Votes added by Cherry Mui

        Code-Review+1

        1 comment

        Patchset-level comments
        Cherry Mui . unresolved

        Looks good overall.
        For extra testing, I'm running it through Google's internal tests, which have substantial uses of cgo and cgo context. I'll report back once the testing is done.

        Thanks!

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Quim Muntal
        Submit Requirements:
        • requirement satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
        Gerrit-Change-Number: 745605
        Gerrit-PatchSet: 5
        Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
        Gerrit-Reviewer: Cherry Mui <cher...@google.com>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
        Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
        Gerrit-Comment-Date: Thu, 19 Feb 2026 23:27:09 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Quim Muntal (Gerrit)

        unread,
        Feb 20, 2026, 3:14:59 AM (5 days ago) Feb 20
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Quim Muntal

        Quim Muntal uploaded new patchset

        Quim Muntal uploaded patch set #6 to this change.
        Following approvals got outdated and were removed:
        • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI

        Related details

        Attention is currently required from:
        • Quim Muntal
        Submit Requirements:
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: newpatchset
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
          Gerrit-Change-Number: 745605
          Gerrit-PatchSet: 6
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Quim Muntal (Gerrit)

          unread,
          Feb 20, 2026, 3:15:50 AM (5 days ago) Feb 20
          to goph...@pubsubhelper.golang.org, Cherry Mui, Ian Lance Taylor, Go LUCI, Michael Pratt, golang-co...@googlegroups.com
          Attention needed from Cherry Mui

          Quim Muntal voted and added 1 comment

          Votes added by Quim Muntal

          Commit-Queue+1

          1 comment

          Patchset-level comments
          Cherry Mui . unresolved

          Looks good overall.
          For extra testing, I'm running it through Google's internal tests, which have substantial uses of cgo and cgo context. I'll report back once the testing is done.

          Thanks!

          Quim Muntal

          Thanks for running those additional tests! This rewrite is kind of tricky...

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Cherry Mui
          Submit Requirements:
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
          Gerrit-Change-Number: 745605
          Gerrit-PatchSet: 6
          Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
          Gerrit-Reviewer: Cherry Mui <cher...@google.com>
          Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
          Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
          Gerrit-Attention: Cherry Mui <cher...@google.com>
          Gerrit-Comment-Date: Fri, 20 Feb 2026 08:15:44 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          Comment-In-Reply-To: Cherry Mui <cher...@google.com>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Quim Muntal (Gerrit)

          unread,
          Feb 24, 2026, 9:42:01 AM (19 hours ago) Feb 24
          to goph...@pubsubhelper.golang.org, Go LUCI, Cherry Mui, Ian Lance Taylor, Michael Pratt, golang-co...@googlegroups.com
          Attention needed from Cherry Mui

          Quim Muntal added 1 comment

          Patchset-level comments
          Cherry Mui . unresolved

          Looks good overall.
          For extra testing, I'm running it through Google's internal tests, which have substantial uses of cgo and cgo context. I'll report back once the testing is done.

          Thanks!

          Quim Muntal

          Thanks for running those additional tests! This rewrite is kind of tricky...

          Quim Muntal

          Any update from the internal Google tests?

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Cherry Mui
          Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
            Gerrit-Change-Number: 745605
            Gerrit-PatchSet: 6
            Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
            Gerrit-Reviewer: Cherry Mui <cher...@google.com>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
            Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
            Gerrit-Attention: Cherry Mui <cher...@google.com>
            Gerrit-Comment-Date: Tue, 24 Feb 2026 14:41:53 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Quim Muntal <quimm...@gmail.com>
            Comment-In-Reply-To: Cherry Mui <cher...@google.com>
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Cherry Mui (Gerrit)

            unread,
            Feb 24, 2026, 10:05:08 AM (19 hours ago) Feb 24
            to Quim Muntal, goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, Michael Pratt, golang-co...@googlegroups.com
            Attention needed from Quim Muntal

            Cherry Mui voted and added 1 comment

            Votes added by Cherry Mui

            Code-Review+1

            1 comment

            Patchset-level comments
            Cherry Mui . unresolved

            Looks good overall.
            For extra testing, I'm running it through Google's internal tests, which have substantial uses of cgo and cgo context. I'll report back once the testing is done.

            Thanks!

            Quim Muntal

            Thanks for running those additional tests! This rewrite is kind of tricky...

            Quim Muntal

            Any update from the internal Google tests?

            Cherry Mui

            Sorry for the delay. I got the results. There are some tests failing that are related to this CL, but I haven't looked them in detail, and identify whether it is this CL, or the code in Google made assumptions depending on the implementation details on the old behavior. My home lost internet yesterday due to weather, so I was not able to looked at them.

            There are some data races found, when the C code is compiled with TSAN. It is possible that CL 747441 would address it. I haven't looked into it.

            I'll look into more today. Thanks.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Quim Muntal
            Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
            Gerrit-Change-Number: 745605
            Gerrit-PatchSet: 6
            Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
            Gerrit-Reviewer: Cherry Mui <cher...@google.com>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
            Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
            Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
            Gerrit-Comment-Date: Tue, 24 Feb 2026 15:05:03 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Cherry Mui (Gerrit)

            unread,
            Feb 24, 2026, 9:38:04 PM (7 hours ago) Feb 24
            to Quim Muntal, goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, Michael Pratt, golang-co...@googlegroups.com
            Attention needed from Quim Muntal

            Cherry Mui voted and added 1 comment

            Votes added by Cherry Mui

            Code-Review+0

            1 comment

            Patchset-level comments
            Cherry Mui . unresolved

            Looks good overall.
            For extra testing, I'm running it through Google's internal tests, which have substantial uses of cgo and cgo context. I'll report back once the testing is done.

            Thanks!

            Quim Muntal

            Thanks for running those additional tests! This rewrite is kind of tricky...

            Quim Muntal

            Any update from the internal Google tests?

            Cherry Mui

            Sorry for the delay. I got the results. There are some tests failing that are related to this CL, but I haven't looked them in detail, and identify whether it is this CL, or the code in Google made assumptions depending on the implementation details on the old behavior. My home lost internet yesterday due to weather, so I was not able to looked at them.

            There are some data races found, when the C code is compiled with TSAN. It is possible that CL 747441 would address it. I haven't looked into it.

            I'll look into more today. Thanks.

            Cherry Mui

            There are two kinds of failures:

            1. As mentioned above, when the C code is compiled with thread sanitizer (not the Go code with race detector), TSAN reports races in accessing the field in the context. It might not be real race, but missed annotation? It is possible that CL 747441 would address it. (I tried this CL alone.)

            2. The place where the context function is called changed. Previously it is on the C stack before calling into Go. Now it is in cgocallbackg1, called via cgocall. Now there are two extra stack transitions, C->Go then Go->C. This may make a difference in context collection. For example, some tests in Google collect a stack trace in the context function. Now with the stack transitions it is not able to trace back through them, and so the C stack is lost. In runtime.SetCgoTraceback documentation (https://pkg.go.dev/runtime#SetCgoTraceback),

            While it would be correct for the context function to record a complete a stack trace whenever it is called, and simply copy that out in the traceback function, in a typical program the context function will be called many times without ever recording a traceback for that context. Recording a complete stack trace in a call to the context function is likely to be inefficient.


            collecting a stack trace in the context function is discouraged but still deemed "correct". This change would break it. Even collecting just the information to identify the execution point for traceback later, like "the stack pointer and PC" as mentioned in the documentation, the stack transitions still make it hard to do full traceback later.

            Given that, I think we may want to keep the property that the context function is called on the C stack without stack transition. Thanks.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Quim Muntal
            Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
            Gerrit-Change-Number: 745605
            Gerrit-PatchSet: 6
            Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
            Gerrit-Reviewer: Cherry Mui <cher...@google.com>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
            Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
            Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
            Gerrit-Comment-Date: Wed, 25 Feb 2026 02:38:00 +0000
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Cherry Mui (Gerrit)

            unread,
            Feb 24, 2026, 10:07:28 PM (7 hours ago) Feb 24
            to Quim Muntal, goph...@pubsubhelper.golang.org, Go LUCI, Ian Lance Taylor, Michael Pratt, golang-co...@googlegroups.com
            Attention needed from Quim Muntal

            Cherry Mui added 1 comment

            Patchset-level comments
            Cherry Mui . unresolved

            Looks good overall.
            For extra testing, I'm running it through Google's internal tests, which have substantial uses of cgo and cgo context. I'll report back once the testing is done.

            Thanks!

            Quim Muntal

            Thanks for running those additional tests! This rewrite is kind of tricky...

            Quim Muntal

            Any update from the internal Google tests?

            Cherry Mui

            Sorry for the delay. I got the results. There are some tests failing that are related to this CL, but I haven't looked them in detail, and identify whether it is this CL, or the code in Google made assumptions depending on the implementation details on the old behavior. My home lost internet yesterday due to weather, so I was not able to looked at them.

            There are some data races found, when the C code is compiled with TSAN. It is possible that CL 747441 would address it. I haven't looked into it.

            I'll look into more today. Thanks.

            Cherry Mui

            There are two kinds of failures:

            1. As mentioned above, when the C code is compiled with thread sanitizer (not the Go code with race detector), TSAN reports races in accessing the field in the context. It might not be real race, but missed annotation? It is possible that CL 747441 would address it. (I tried this CL alone.)

            2. The place where the context function is called changed. Previously it is on the C stack before calling into Go. Now it is in cgocallbackg1, called via cgocall. Now there are two extra stack transitions, C->Go then Go->C. This may make a difference in context collection. For example, some tests in Google collect a stack trace in the context function. Now with the stack transitions it is not able to trace back through them, and so the C stack is lost. In runtime.SetCgoTraceback documentation (https://pkg.go.dev/runtime#SetCgoTraceback),

            While it would be correct for the context function to record a complete a stack trace whenever it is called, and simply copy that out in the traceback function, in a typical program the context function will be called many times without ever recording a traceback for that context. Recording a complete stack trace in a call to the context function is likely to be inefficient.


            collecting a stack trace in the context function is discouraged but still deemed "correct". This change would break it. Even collecting just the information to identify the execution point for traceback later, like "the stack pointer and PC" as mentioned in the documentation, the stack transitions still make it hard to do full traceback later.

            Given that, I think we may want to keep the property that the context function is called on the C stack without stack transition. Thanks.

            Cherry Mui

            Well, the comment is formatted weirdly. Hopefully you can still read it. Reported a bug internally.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Quim Muntal
            Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
            Gerrit-Change-Number: 745605
            Gerrit-PatchSet: 6
            Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
            Gerrit-Reviewer: Cherry Mui <cher...@google.com>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
            Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
            Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
            Gerrit-Comment-Date: Wed, 25 Feb 2026 03:07:22 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Ian Lance Taylor (Gerrit)

            unread,
            Feb 24, 2026, 11:15:48 PM (6 hours ago) Feb 24
            to Quim Muntal, goph...@pubsubhelper.golang.org, Go LUCI, Cherry Mui, Ian Lance Taylor, Michael Pratt, golang-co...@googlegroups.com
            Attention needed from Quim Muntal

            Ian Lance Taylor voted and added 1 comment

            Votes added by Ian Lance Taylor

            Code-Review+0

            1 comment

            Patchset-level comments
            Cherry Mui . unresolved

            Looks good overall.
            For extra testing, I'm running it through Google's internal tests, which have substantial uses of cgo and cgo context. I'll report back once the testing is done.

            Thanks!

            Quim Muntal

            Thanks for running those additional tests! This rewrite is kind of tricky...

            Quim Muntal

            Any update from the internal Google tests?

            Cherry Mui

            Sorry for the delay. I got the results. There are some tests failing that are related to this CL, but I haven't looked them in detail, and identify whether it is this CL, or the code in Google made assumptions depending on the implementation details on the old behavior. My home lost internet yesterday due to weather, so I was not able to looked at them.

            There are some data races found, when the C code is compiled with TSAN. It is possible that CL 747441 would address it. I haven't looked into it.

            I'll look into more today. Thanks.

            Cherry Mui

            There are two kinds of failures:

            1. As mentioned above, when the C code is compiled with thread sanitizer (not the Go code with race detector), TSAN reports races in accessing the field in the context. It might not be real race, but missed annotation? It is possible that CL 747441 would address it. (I tried this CL alone.)

            2. The place where the context function is called changed. Previously it is on the C stack before calling into Go. Now it is in cgocallbackg1, called via cgocall. Now there are two extra stack transitions, C->Go then Go->C. This may make a difference in context collection. For example, some tests in Google collect a stack trace in the context function. Now with the stack transitions it is not able to trace back through them, and so the C stack is lost. In runtime.SetCgoTraceback documentation (https://pkg.go.dev/runtime#SetCgoTraceback),

            While it would be correct for the context function to record a complete a stack trace whenever it is called, and simply copy that out in the traceback function, in a typical program the context function will be called many times without ever recording a traceback for that context. Recording a complete stack trace in a call to the context function is likely to be inefficient.


            collecting a stack trace in the context function is discouraged but still deemed "correct". This change would break it. Even collecting just the information to identify the execution point for traceback later, like "the stack pointer and PC" as mentioned in the documentation, the stack transitions still make it hard to do full traceback later.

            Given that, I think we may want to keep the property that the context function is called on the C stack without stack transition. Thanks.

            Cherry Mui

            Well, the comment is formatted weirdly. Hopefully you can still read it. Reported a bug internally.

            Ian Lance Taylor

            Cherry, thanks for pointing that out. You're right, of course: the context function needs to be called at the same point in the call stack. It unfortunately can't be called from Go code. I don't see how that could work.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Quim Muntal
            Submit Requirements:
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
            Gerrit-Change-Number: 745605
            Gerrit-PatchSet: 6
            Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
            Gerrit-Reviewer: Cherry Mui <cher...@google.com>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
            Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
            Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
            Gerrit-Comment-Date: Wed, 25 Feb 2026 04:15:45 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: Yes
            unsatisfied_requirement
            satisfied_requirement
            open
            diffy

            Quim Muntal (Gerrit)

            unread,
            3:14 AM (2 hours ago) 3:14 AM
            to goph...@pubsubhelper.golang.org, Go LUCI, Cherry Mui, Ian Lance Taylor, Michael Pratt, golang-co...@googlegroups.com
            Attention needed from Cherry Mui and Ian Lance Taylor

            Quim Muntal added 1 comment

            Patchset-level comments
            File-level comment, Patchset 5:
            Cherry Mui . resolved

            Looks good overall.
            For extra testing, I'm running it through Google's internal tests, which have substantial uses of cgo and cgo context. I'll report back once the testing is done.

            Thanks!

            Quim Muntal

            Thanks for running those additional tests! This rewrite is kind of tricky...

            Quim Muntal

            Any update from the internal Google tests?

            Cherry Mui

            Sorry for the delay. I got the results. There are some tests failing that are related to this CL, but I haven't looked them in detail, and identify whether it is this CL, or the code in Google made assumptions depending on the implementation details on the old behavior. My home lost internet yesterday due to weather, so I was not able to looked at them.

            There are some data races found, when the C code is compiled with TSAN. It is possible that CL 747441 would address it. I haven't looked into it.

            I'll look into more today. Thanks.

            Cherry Mui

            There are two kinds of failures:

            1. As mentioned above, when the C code is compiled with thread sanitizer (not the Go code with race detector), TSAN reports races in accessing the field in the context. It might not be real race, but missed annotation? It is possible that CL 747441 would address it. (I tried this CL alone.)

            2. The place where the context function is called changed. Previously it is on the C stack before calling into Go. Now it is in cgocallbackg1, called via cgocall. Now there are two extra stack transitions, C->Go then Go->C. This may make a difference in context collection. For example, some tests in Google collect a stack trace in the context function. Now with the stack transitions it is not able to trace back through them, and so the C stack is lost. In runtime.SetCgoTraceback documentation (https://pkg.go.dev/runtime#SetCgoTraceback),

            While it would be correct for the context function to record a complete a stack trace whenever it is called, and simply copy that out in the traceback function, in a typical program the context function will be called many times without ever recording a traceback for that context. Recording a complete stack trace in a call to the context function is likely to be inefficient.


            collecting a stack trace in the context function is discouraged but still deemed "correct". This change would break it. Even collecting just the information to identify the execution point for traceback later, like "the stack pointer and PC" as mentioned in the documentation, the stack transitions still make it hard to do full traceback later.

            Given that, I think we may want to keep the property that the context function is called on the C stack without stack transition. Thanks.

            Cherry Mui

            Well, the comment is formatted weirdly. Hopefully you can still read it. Reported a bug internally.

            Ian Lance Taylor

            Cherry, thanks for pointing that out. You're right, of course: the context function needs to be called at the same point in the call stack. It unfortunately can't be called from Go code. I don't see how that could work.

            Quim Muntal

            Thank for the review and for running the tests. It is a pity that we can't do this. I'll abandone this CL and some of the following in this chain.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Cherry Mui
            • Ian Lance Taylor
            Submit Requirements:
              • requirement is not satisfiedCode-Review
              • requirement satisfiedNo-Unresolved-Comments
              • requirement is not satisfiedReview-Enforcement
              • requirement satisfiedTryBots-Pass
              Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
              Gerrit-MessageType: comment
              Gerrit-Project: go
              Gerrit-Branch: master
              Gerrit-Change-Id: I79a9d444b39ddf32551750998b5afd24444d4992
              Gerrit-Change-Number: 745605
              Gerrit-PatchSet: 6
              Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
              Gerrit-Reviewer: Cherry Mui <cher...@google.com>
              Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
              Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
              Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
              Gerrit-Attention: Cherry Mui <cher...@google.com>
              Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
              Gerrit-Comment-Date: Wed, 25 Feb 2026 08:14:48 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              Comment-In-Reply-To: Quim Muntal <quimm...@gmail.com>
              Comment-In-Reply-To: Cherry Mui <cher...@google.com>
              unsatisfied_requirement
              satisfied_requirement
              open
              diffy

              Quim Muntal (Gerrit)

              unread,
              3:15 AM (2 hours ago) 3:15 AM
              to goph...@pubsubhelper.golang.org, Go LUCI, Cherry Mui, Ian Lance Taylor, Michael Pratt, golang-co...@googlegroups.com

              Quim Muntal abandoned this change.

              View Change

              Abandoned

              Quim Muntal abandoned this change

              Related details

              Attention set is empty
              Submit Requirements:
              • requirement is not satisfiedCode-Review
              • requirement satisfiedNo-Unresolved-Comments
              • requirement is not satisfiedReview-Enforcement
              • requirement satisfiedTryBots-Pass
              Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
              Gerrit-MessageType: abandon
              unsatisfied_requirement
              satisfied_requirement
              open
              diffy
              Reply all
              Reply to author
              Forward
              0 new messages