Skip to content

NoGCRegion Callback - #82045

Merged
cshung merged 1 commit into
dotnet:mainfrom
cshung:public/no-gc-region-callback
May 21, 2023
Merged

NoGCRegion Callback#82045
cshung merged 1 commit into
dotnet:mainfrom
cshung:public/no-gc-region-callback

Conversation

@cshung

@cshungcshung commented Feb 13, 2023

Copy link
Copy Markdown
Contributor

This PR implements the RegisterNoGCCallback API proposal.

Fixes#66039

@cshung
cshung marked this pull request as draft February 13, 2023 19:29
@ghostghost assigned cshungFeb 13, 2023
@ghost

Copy link
Copy Markdown

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost

Copy link
Copy Markdown

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@ghost

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/gc
See info in area-owners.md if you want to be subscribed.

Issue Details

WIP - testing only

Author:cshung
Assignees:cshung
Labels:

area-GC-coreclr, new-api-needs-documentation

Milestone:-

@cshung
cshungforce-pushed the public/no-gc-region-callback branch from 58de138 to e647be2CompareFebruary 15, 2023 20:55
@cshung
cshungforce-pushed the public/no-gc-region-callback branch 2 times, most recently from 3e1c057 to 6048304CompareFebruary 27, 2023 21:18
@cshung
cshung marked this pull request as ready for review February 28, 2023 06:48
Comment threadsrc/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs Outdated
Comment threadsrc/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs Outdated
Comment threadsrc/coreclr/gc/gc.cpp Outdated
Comment threadsrc/coreclr/gc/gcinterface.h Outdated
Comment threadsrc/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs Outdated
Comment threadsrc/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs Outdated
Comment threadsrc/coreclr/nativeaot/System.Private.CoreLib/src/System/GC.NativeAot.cs Outdated
Comment threadsrc/coreclr/gc/gc.cpp Outdated
Comment threadsrc/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs Outdated
Comment threadsrc/libraries/System.Private.CoreLib/src/Resources/Strings.resx Outdated
Comment threadsrc/libraries/System.Private.CoreLib/src/Resources/Strings.resx Outdated
Comment threadsrc/libraries/System.Private.CoreLib/src/Resources/Strings.resx Outdated
Comment threadsrc/tests/GC/API/NoGCRegion/Callback.cs Outdated
Comment threadsrc/coreclr/gc/gc.cpp Outdated
Comment threadsrc/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs Outdated
Comment threadsrc/coreclr/nativeaot/System.Private.CoreLib/src/System/GC.NativeAot.cs Outdated
Comment threadsrc/coreclr/gc/gcimpl.h Outdated
Comment threadsrc/coreclr/vm/finalizerthread.cpp Outdated
@jkotas

Copy link
Copy Markdown
Member

If the finalizer thread got the work, but then sleep for indefinite amount of time before it actually does the work,

What about if the thread is rescheduled right after we check the cookie, but before actually doing the work?

It seems that the cookie is reducing probability of the race condition, but it is not actually reliably preventing the race condition.

Comment threadsrc/coreclr/gc/gc.cpp Outdated
Comment threadsrc/tests/GC/API/NoGCRegion/Callback_Svr.csproj Outdated
@jkotas

Copy link
Copy Markdown
Member

VM side - LGTM! @Maoni0 should sign-off on the GC side.

Comment threadsrc/coreclr/gc/gc.cpp Outdated
Comment threadsrc/coreclr/gc/gcinterface.h Outdated
Comment threadsrc/coreclr/gc/gc.cpp Outdated

@Maoni0Maoni0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other than the couple of comments above, this LGTM!

@cshung
cshungforce-pushed the public/no-gc-region-callback branch from e557c26 to 9f1ca40CompareMay 20, 2023 22:27
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@cshung
cshungforce-pushed the public/no-gc-region-callback branch from 9f1ca40 to 0ecb53fCompareMay 20, 2023 23:59
@cshung
cshung merged commit 6a02ab2 into dotnet:mainMay 21, 2023
@cshung
cshung deleted the public/no-gc-region-callback branch May 21, 2023 01:46
@ghostghost locked as resolved and limited conversation to collaborators Jun 20, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API Proposal]: NoGC callback

7 participants

@cshung@Maoni0@jkotas@WenceyWang@PeterSolMS@AaronRobinsonMSFT@mrsharm