feature: capture multiple cpu pagefault handler

Recorded multiple page fault handlers by using vector in
cpu_page_fault_manager_linux.

Added a static handlerIndex in order to track the depth of
handler logic to call appropriate previous handlers.

Related-To: NEO-11563
Signed-off-by: Young Jin Yoon <young.jin.yoon@intel.com>
This commit is contained in:
Young Jin Yoon
2024-07-17 19:10:37 +00:00
committed by Compute-Runtime-Automation
parent e1af5d8da7
commit 44f2912195
11 changed files with 323 additions and 41 deletions

View File

@@ -95,14 +95,16 @@ inline void PageFaultManager::migrateStorageToGpuDomain(void *ptr, PageFaultData
pageFaultData.domain = AllocationDomain::gpu;
}
bool PageFaultManager::verifyPageFault(void *ptr) {
bool PageFaultManager::verifyAndHandlePageFault(void *ptr, bool handlePageFault) {
std::unique_lock<SpinLock> lock{mtx};
for (auto &alloc : this->memoryData) {
auto allocPtr = alloc.first;
auto &pageFaultData = alloc.second;
if (ptr >= allocPtr && ptr < ptrOffset(allocPtr, pageFaultData.size)) {
this->setAubWritable(true, allocPtr, pageFaultData.unifiedMemoryManager);
gpuDomainHandler(this, allocPtr, pageFaultData);
if (handlePageFault) {
this->setAubWritable(true, allocPtr, pageFaultData.unifiedMemoryManager);
gpuDomainHandler(this, allocPtr, pageFaultData);
}
return true;
}
}