Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[NativeAOT] Make conservative stack reporting configurable. #75803

Merged
merged 4 commits into from
Sep 18, 2022

Conversation

VSadov
Copy link
Member

@VSadov VSadov commented Sep 17, 2022

Conservative stack reporting is a convenient option when investigating issues with suspension/unwinding/root reporting.
Having to rebuild the runtime and testcases in order to switch is not convenient though as switching back and forth takes a very long time.

This change allows turning conservative stack reporting off/on via environment variable.

@@ -16,6 +16,7 @@ DEBUG_CONFIG_VALUE_WITH_DEFAULT(BreakOnAssert, 1)
RETAIL_CONFIG_VALUE(StressLogLevel)
RETAIL_CONFIG_VALUE(TotalStressLogSize)
RETAIL_CONFIG_VALUE(gcServer)
RETAIL_CONFIG_VALUE(GcConservativeStacks) // Enables conservative stack reporting
Copy link
Member

Choose a reason for hiding this comment

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

We should call it the same thing as in CoreCLR (

RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_gcConservative, W("gcConservative"), 0, "Enables/Disables conservative GC")
)

Copy link
Member Author

@VSadov VSadov Sep 17, 2022

Choose a reason for hiding this comment

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

gcConservative turns support for conservative reporting in the GC. NativeAOT enables that unconditionally.
I think if we use the same key we will see it always "on".

Copy link
Member

Choose a reason for hiding this comment

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

gcConservative turns on conservative stack scanning in CoreCLR:

if (g_pConfig->GetGCConservative())
.

NativeAOT enables that unconditionally. I think if we use the same key we will see it always "on".

The GC should see it as always on in NativeAOT, but the runtime should use the env variable that you are adding.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually it looks like we intercept gcConservative when GC asks about it. We may be able to use the same key.

Another issue could be that gcConservative would affect the test infrastructure as well as NativeAOT tests. That is probably ok.

@VSadov
Copy link
Member Author

VSadov commented Sep 18, 2022

Thanks!

@VSadov VSadov merged commit 5fa18e6 into dotnet:main Sep 18, 2022
@VSadov VSadov deleted the consConf branch September 18, 2022 05:42
MichalStrehovsky added a commit to MichalStrehovsky/runtime that referenced this pull request Sep 19, 2022
Follow up to dotnet#75803.

If enabled, conservative GC stack scanning will be used and metadata related to GC stack reporting will not be generated. The generated executable file will be smaller, but the GC will be less efficient (garbage collection might take longer and keep objects alive for longer periods of time than usual).

Saves 4.4% in size on a Hello World. I'll take that.
@ghost ghost locked as resolved and limited conversation to collaborators Oct 18, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants