Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fixes to EtwCallback and EtwCallbackCommon: #35793

Merged
merged 2 commits into from
May 6, 2020

Conversation

PeterSolMS
Copy link
Contributor

  • Only call GCHeapUtilities::RecordEventStateChange for EVENT_CONTROL_CODE_ENABLE_PROVIDER or EVENT_CONTROL_CODE_DISABLE_PROVIDER, not for EVENT_CONTROL_CODE_CAPTURE_STATE.
  • Only call GCHeapUtilities::RecordEventStateChange for DotNETRuntime and DotNETRuntimePrivate providers
  • Consolidate level and keywords between EventPipe and ETW, so that disabling an event on one side does not disable it for the other side, if the other side is still interested in it.

- Only call GCHeapUtilities::RecordEventStateChange for EVENT_CONTROL_CODE_ENABLE_PROVIDER or  EVENT_CONTROL_CODE_DISABLE_PROVIDER, *not* for EVENT_CONTROL_CODE_CAPTURE_STATE.
- Only call GCHeapUtilities::RecordEventStateChange for DotNETRuntime and DotNETRuntimePrivate providers
- Consolidate level and keywords between EventPipe and ETW, so that disabling an event on one side does not disable it for the other side, if the other side is still interested in it.
Copy link
Member

@brianrob brianrob left a comment

Choose a reason for hiding this comment

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

Thanks @PeterSolMS. One small change, but otherwise, LGTM.

@@ -4272,6 +4269,18 @@ VOID EtwCallbackCommon(
ctxToUpdate->EventPipeProvider.EnabledKeywordsBitmask = MatchAnyKeyword;
}

if ((ControlCode == EVENT_CONTROL_CODE_ENABLE_PROVIDER || ControlCode == EVENT_CONTROL_CODE_DISABLE_PROVIDER) &&
Copy link
Member

Choose a reason for hiding this comment

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

I think you probably want to also maintain the g_fEEStarted && !g_fEEShutdown conditions here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not because we really want the settings on the GC side to mimic what's set on the VM side, and the VM side does not check g_fEEStarted and !g_fEEShutdown before setting level and keywords.

Also, I noticed that the first call to EtwCallbackCommon happens when g_fEEStarted is still FALSE, so we'd miss that first call.

Copy link
Member

Choose a reason for hiding this comment

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

I see. As long as the call is safe to make during startup and shutdown, then that's OK. I know that a bunch of the other calls that are inside the if statement below are unsafe and will throw.

Copy link
Member

@Maoni0 Maoni0 left a comment

Choose a reason for hiding this comment

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

LGTM!

@jeffschwMSFT
Copy link
Member

Fix for #34423

@PeterSolMS
Copy link
Contributor Author

Thanks Brian and Maoni!

@PeterSolMS PeterSolMS merged commit 09501e3 into dotnet:master May 6, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
Sign up for free to 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.

5 participants