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

Eventpipe block unregister for callbacks #105734

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/coreclr/inc/CrstTypes.def
Original file line number Diff line number Diff line change
Expand Up @@ -581,3 +581,8 @@ End
Crst PerfMap
AcquiredAfter CodeVersioning AssemblyList
End

Crst EventPipeCallbackDispatch
AcquiredAfter PendingTypeLoadEntry
AcquiredBefore EventPipe
End
185 changes: 94 additions & 91 deletions src/coreclr/inc/crsttypes_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,95 +45,96 @@ enum CrstType
CrstDynamicMT = 27,
CrstEtwTypeLogHash = 28,
CrstEventPipe = 29,
CrstEventStore = 30,
CrstException = 31,
CrstExecutableAllocatorLock = 32,
CrstExecuteManRangeLock = 33,
CrstFCall = 34,
CrstFrozenObjectHeap = 35,
CrstFuncPtrStubs = 36,
CrstFusionAppCtx = 37,
CrstGCCover = 38,
CrstGenericDictionaryExpansion = 39,
CrstGlobalStrLiteralMap = 40,
CrstHandleTable = 41,
CrstIbcProfile = 42,
CrstIJWFixupData = 43,
CrstIJWHash = 44,
CrstILStubGen = 45,
CrstInlineTrackingMap = 46,
CrstInstMethodHashTable = 47,
CrstInterop = 48,
CrstInteropData = 49,
CrstIsJMCMethod = 50,
CrstISymUnmanagedReader = 51,
CrstJit = 52,
CrstJitGenericHandleCache = 53,
CrstJitInlineTrackingMap = 54,
CrstJitPatchpoint = 55,
CrstJitPerf = 56,
CrstJumpStubCache = 57,
CrstLeafLock = 58,
CrstListLock = 59,
CrstLoaderAllocator = 60,
CrstLoaderAllocatorReferences = 61,
CrstLoaderHeap = 62,
CrstManagedObjectWrapperMap = 63,
CrstMethodDescBackpatchInfoTracker = 64,
CrstMethodTableExposedObject = 65,
CrstModule = 66,
CrstModuleFixup = 67,
CrstModuleLookupTable = 68,
CrstMulticoreJitHash = 69,
CrstMulticoreJitManager = 70,
CrstNativeImageEagerFixups = 71,
CrstNativeImageLoad = 72,
CrstNls = 73,
CrstNotifyGdb = 74,
CrstObjectList = 75,
CrstPEImage = 76,
CrstPendingTypeLoadEntry = 77,
CrstPerfMap = 78,
CrstPgoData = 79,
CrstPinnedByrefValidation = 80,
CrstPinnedHeapHandleTable = 81,
CrstProfilerGCRefDataFreeList = 82,
CrstProfilingAPIStatus = 83,
CrstRCWCache = 84,
CrstRCWCleanupList = 85,
CrstReadyToRunEntryPointToMethodDescMap = 86,
CrstReflection = 87,
CrstReJITGlobalRequest = 88,
CrstRetThunkCache = 89,
CrstSavedExceptionInfo = 90,
CrstSaveModuleProfileData = 91,
CrstSigConvert = 92,
CrstSingleUseLock = 93,
CrstSpecialStatics = 94,
CrstStackSampler = 95,
CrstStressLog = 96,
CrstStubCache = 97,
CrstStubDispatchCache = 98,
CrstStubUnwindInfoHeapSegments = 99,
CrstSyncBlockCache = 100,
CrstSyncHashLock = 101,
CrstSystemBaseDomain = 102,
CrstSystemDomain = 103,
CrstSystemDomainDelayedUnloadList = 104,
CrstThreadIdDispenser = 105,
CrstThreadLocalStorageLock = 106,
CrstThreadStore = 107,
CrstTieredCompilation = 108,
CrstTypeEquivalenceMap = 109,
CrstTypeIDMap = 110,
CrstUMEntryThunkCache = 111,
CrstUMEntryThunkFreeListLock = 112,
CrstUniqueStack = 113,
CrstUnresolvedClassLock = 114,
CrstUnwindInfoTableLock = 115,
CrstVSDIndirectionCellLock = 116,
CrstWrapperTemplate = 117,
kNumberOfCrstTypes = 118
CrstEventPipeCallbackDispatch = 30,
CrstEventStore = 31,
CrstException = 32,
CrstExecutableAllocatorLock = 33,
CrstExecuteManRangeLock = 34,
CrstFCall = 35,
CrstFrozenObjectHeap = 36,
CrstFuncPtrStubs = 37,
CrstFusionAppCtx = 38,
CrstGCCover = 39,
CrstGenericDictionaryExpansion = 40,
CrstGlobalStrLiteralMap = 41,
CrstHandleTable = 42,
CrstIbcProfile = 43,
CrstIJWFixupData = 44,
CrstIJWHash = 45,
CrstILStubGen = 46,
CrstInlineTrackingMap = 47,
CrstInstMethodHashTable = 48,
CrstInterop = 49,
CrstInteropData = 50,
CrstIsJMCMethod = 51,
CrstISymUnmanagedReader = 52,
CrstJit = 53,
CrstJitGenericHandleCache = 54,
CrstJitInlineTrackingMap = 55,
CrstJitPatchpoint = 56,
CrstJitPerf = 57,
CrstJumpStubCache = 58,
CrstLeafLock = 59,
CrstListLock = 60,
CrstLoaderAllocator = 61,
CrstLoaderAllocatorReferences = 62,
CrstLoaderHeap = 63,
CrstManagedObjectWrapperMap = 64,
CrstMethodDescBackpatchInfoTracker = 65,
CrstMethodTableExposedObject = 66,
CrstModule = 67,
CrstModuleFixup = 68,
CrstModuleLookupTable = 69,
CrstMulticoreJitHash = 70,
CrstMulticoreJitManager = 71,
CrstNativeImageEagerFixups = 72,
CrstNativeImageLoad = 73,
CrstNls = 74,
CrstNotifyGdb = 75,
CrstObjectList = 76,
CrstPEImage = 77,
CrstPendingTypeLoadEntry = 78,
CrstPerfMap = 79,
CrstPgoData = 80,
CrstPinnedByrefValidation = 81,
CrstPinnedHeapHandleTable = 82,
CrstProfilerGCRefDataFreeList = 83,
CrstProfilingAPIStatus = 84,
CrstRCWCache = 85,
CrstRCWCleanupList = 86,
CrstReadyToRunEntryPointToMethodDescMap = 87,
CrstReflection = 88,
CrstReJITGlobalRequest = 89,
CrstRetThunkCache = 90,
CrstSavedExceptionInfo = 91,
CrstSaveModuleProfileData = 92,
CrstSigConvert = 93,
CrstSingleUseLock = 94,
CrstSpecialStatics = 95,
CrstStackSampler = 96,
CrstStressLog = 97,
CrstStubCache = 98,
CrstStubDispatchCache = 99,
CrstStubUnwindInfoHeapSegments = 100,
CrstSyncBlockCache = 101,
CrstSyncHashLock = 102,
CrstSystemBaseDomain = 103,
CrstSystemDomain = 104,
CrstSystemDomainDelayedUnloadList = 105,
CrstThreadIdDispenser = 106,
CrstThreadLocalStorageLock = 107,
CrstThreadStore = 108,
CrstTieredCompilation = 109,
CrstTypeEquivalenceMap = 110,
CrstTypeIDMap = 111,
CrstUMEntryThunkCache = 112,
CrstUMEntryThunkFreeListLock = 113,
CrstUniqueStack = 114,
CrstUnresolvedClassLock = 115,
CrstUnwindInfoTableLock = 116,
CrstVSDIndirectionCellLock = 117,
CrstWrapperTemplate = 118,
kNumberOfCrstTypes = 119
};

#endif // __CRST_TYPES_INCLUDED
Expand Down Expand Up @@ -174,6 +175,7 @@ int g_rgCrstLevelMap[] =
10, // CrstDynamicMT
0, // CrstEtwTypeLogHash
20, // CrstEventPipe
21, // CrstEventPipeCallbackDispatch
0, // CrstEventStore
0, // CrstException
0, // CrstExecutableAllocatorLock
Expand All @@ -192,7 +194,7 @@ int g_rgCrstLevelMap[] =
7, // CrstILStubGen
3, // CrstInlineTrackingMap
19, // CrstInstMethodHashTable
22, // CrstInterop
23, // CrstInterop
10, // CrstInteropData
0, // CrstIsJMCMethod
7, // CrstISymUnmanagedReader
Expand Down Expand Up @@ -221,7 +223,7 @@ int g_rgCrstLevelMap[] =
0, // CrstNotifyGdb
2, // CrstObjectList
5, // CrstPEImage
21, // CrstPendingTypeLoadEntry
22, // CrstPendingTypeLoadEntry
0, // CrstPerfMap
4, // CrstPgoData
0, // CrstPinnedByrefValidation
Expand Down Expand Up @@ -297,6 +299,7 @@ LPCSTR g_rgCrstNameMap[] =
"CrstDynamicMT",
"CrstEtwTypeLogHash",
"CrstEventPipe",
"CrstEventPipeCallbackDispatch",
"CrstEventStore",
"CrstException",
"CrstExecutableAllocatorLock",
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/nativeaot/Runtime/Crst.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum CrstType
CrstEventPipe,
CrstEventPipeConfig,
CrstGcEvent,
CrstEventPipeCallbackDispatch,
};

enum CrstFlags
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/nativeaot/Runtime/eventpipe/ep-rt-aot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
ep_rt_lock_handle_t _ep_rt_aot_config_lock_handle;
CrstStatic _ep_rt_aot_config_lock;

ep_rt_lock_handle_t _ep_rt_aot_callback_dispatch_lock_handle;
CrstStatic _ep_rt_aot_callback_dispatch_lock;

#ifndef TARGET_UNIX
uint32_t *_ep_rt_aot_proc_group_offsets;
Expand Down Expand Up @@ -701,6 +703,12 @@ void ep_rt_aot_init (void)

_ep_rt_aot_config_lock_handle.lock = &_ep_rt_aot_config_lock;
_ep_rt_aot_config_lock_handle.lock->InitNoThrow (CrstType::CrstEventPipeConfig);

extern ep_rt_lock_handle_t _ep_rt_aot_callback_dispatch_lock_handle;
extern CrstStatic _ep_rt_aot_callback_dispatch_lock;

_ep_rt_aot_callback_dispatch_lock_handle.lock = &_ep_rt_aot_callback_dispatch_lock;
_ep_rt_aot_callback_dispatch_lock_handle.lock->InitNoThrow (CrstType::CrstEventPipeCallbackDispatch);
}

bool ep_rt_aot_lock_acquire (ep_rt_lock_handle_t *lock)
Expand Down
42 changes: 42 additions & 0 deletions src/coreclr/nativeaot/Runtime/eventpipe/ep-rt-aot.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ ep_rt_aot_config_lock_get (void)
return &_ep_rt_aot_config_lock_handle;
}

static
inline
ep_rt_lock_handle_t *
ep_rt_aot_callback_dispatch_lock_get (void)
{
extern ep_rt_lock_handle_t _ep_rt_aot_callback_dispatch_lock_handle;
return &_ep_rt_aot_callback_dispatch_lock_handle;
}


static
inline
const ep_char8_t *
Expand Down Expand Up @@ -284,6 +294,22 @@ ep_rt_config_release (void)
return ep_rt_lock_release (ep_rt_aot_config_lock_get ());
}

static
inline
bool
ep_rt_callback_dispatch_acquire (void)
{
return ep_rt_lock_acquire (ep_rt_aot_callback_dispatch_lock_get ());
}

static
inline
bool
ep_rt_callback_dispatch_release (void)
{
return ep_rt_lock_release (ep_rt_aot_callback_dispatch_lock_get ());
}

#ifdef EP_CHECKED_BUILD
static
inline
Expand All @@ -300,6 +326,22 @@ ep_rt_config_requires_lock_not_held (void)
{
ep_rt_lock_requires_lock_not_held (ep_rt_aot_config_lock_get ());
}

static
inline
void
ep_rt_requires_callback_dispatch_lock_held (void)
{
ep_rt_lock_requires_lock_held (ep_rt_aot_callback_dispatch_lock_get ());
}

static
inline
void
ep_rt_requires_callback_dispatch_lock_not_held (void)
{
ep_rt_lock_requires_lock_not_held (ep_rt_aot_callback_dispatch_lock_get ());
}
#endif

static
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
ep_rt_lock_handle_t _ep_rt_coreclr_config_lock_handle;
CrstStatic _ep_rt_coreclr_config_lock;

ep_rt_lock_handle_t _ep_rt_coreclr_callback_dispatch_lock_handle;
CrstStatic _ep_rt_coreclr_callback_dispatch_lock;

thread_local EventPipeCoreCLRThreadHolderTLS EventPipeCoreCLRThreadHolderTLS::g_threadHolderTLS;

ep_char8_t *volatile _ep_rt_coreclr_diagnostics_cmd_line;
Expand Down
Loading
Loading