Skip to content

Fixes to EtwCallback and EtwCallbackCommon:#35793

Merged
PeterSolMS merged 2 commits intodotnet:masterfrom
PeterSolMS:ETW-Fixes
May 6, 2020
Merged

Fixes to EtwCallback and EtwCallbackCommon:#35793
PeterSolMS merged 2 commits intodotnet:masterfrom
PeterSolMS:ETW-Fixes

Conversation

@PeterSolMS
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread src/coreclr/src/vm/eventtrace.cpp Outdated
ctxToUpdate->EventPipeProvider.EnabledKeywordsBitmask = MatchAnyKeyword;
}

if ((ControlCode == EVENT_CONTROL_CODE_ENABLE_PROVIDER || ControlCode == EVENT_CONTROL_CODE_DISABLE_PROVIDER) &&
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.

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Fix for #34423

@PeterSolMS
Copy link
Copy Markdown
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