mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
refactor: capability to print mmap and munmap calls
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
4b5d5f235a
commit
fcd57f94cf
@@ -275,6 +275,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, SetProcessPowerThrottlingState, -1, "-1: default
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, SetThreadPriority, -1, "-1: default, 0: Disabled, 1: Enabled. If set, will set thread priority to above normal on os context init. Windows only.")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideCpuCaching, -1, "-1: default, 1: DRM_XE_GEM_CPU_CACHING_WB, 2: DRM_XE_GEM_CPU_CACHING_WC")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, FlushTlbBeforeCopy, -1, "-1: default, 0: Dont flush, 1: flush TLB as part of MI_FLUSH_DW/PIPE_CONTROL command before copy operation")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, PrintMmapAndMunMapCalls, -1, "-1: default, If set, print all system mmap and munmap calls")
|
||||
|
||||
/*LOGGING FLAGS*/
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, PrintDriverDiagnostics, -1, "prints driver diagnostics messages to standard output, value corresponds to hint level")
|
||||
|
||||
@@ -53,6 +53,22 @@ namespace NEO {
|
||||
|
||||
using AllocationStatus = MemoryManager::AllocationStatus;
|
||||
|
||||
int debugMunmap(void *ptr, size_t size) noexcept {
|
||||
int returnVal = munmap(ptr, size);
|
||||
|
||||
printf("\n%s: munmap(%p, %zu) = %d", __FUNCTION__, ptr, size, returnVal);
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
void *debugMmap(void *ptr, size_t size, int prot, int flags, int fd, off_t offset) noexcept {
|
||||
void *returnVal = mmap(ptr, size, prot, flags, fd, offset);
|
||||
|
||||
printf("\n%s: mmap(%p, %zu, %d, %d, %d, %ld) = %p", __FUNCTION__, ptr, size, prot, flags, fd, offset, returnVal);
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
DrmMemoryManager::DrmMemoryManager(GemCloseWorkerMode mode,
|
||||
bool forcePinAllowed,
|
||||
bool validateHostPtrMemory,
|
||||
@@ -60,6 +76,11 @@ DrmMemoryManager::DrmMemoryManager(GemCloseWorkerMode mode,
|
||||
forcePinEnabled(forcePinAllowed),
|
||||
validateHostPtrMemory(validateHostPtrMemory) {
|
||||
|
||||
if (debugManager.flags.PrintMmapAndMunMapCalls.get() == 1) {
|
||||
this->munmapFunction = debugMunmap;
|
||||
this->mmapFunction = debugMmap;
|
||||
}
|
||||
|
||||
alignmentSelector.addCandidateAlignment(MemoryConstants::pageSize64k, true, AlignmentSelector::anyWastage, HeapIndex::heapStandard64KB);
|
||||
if (debugManager.flags.AlignLocalMemoryVaTo2MB.get() != 0) {
|
||||
alignmentSelector.addCandidateAlignment(MemoryConstants::pageSize2M, false, AlignmentSelector::anyWastage, HeapIndex::heapStandard2MB);
|
||||
|
||||
Reference in New Issue
Block a user