mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 07:14:10 +08:00
Addresses regressions from the reverted merge of the tbx fault manager for host memory. Recursive locking of mutex caused deadlock. To fix, separate tbx fault data from base cpu fault data, allowing separate mutexes for each, eliminating recursive locks on the same mutex. By separating, we also help ensure that tbx-related changes don't affect the original cpu fault manager code paths. As an added safe guard preventing critical regressions and avoiding another auto-revert, the tbx fault manager is hidden behind a new debug flag which is disabled by default. Related-To: NEO-12268 Signed-off-by: Jack Myers <jack.myers@intel.com>
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
/*
|
|
* Copyright (C) 2024-2025 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "shared/source/page_fault_manager/cpu_page_fault_manager.h"
|
|
|
|
namespace NEO {
|
|
class CommandStreamReceiver;
|
|
class GraphicsAllocation;
|
|
|
|
class TbxPageFaultManager : public virtual CpuPageFaultManager {
|
|
public:
|
|
struct PageFaultDataTbx {
|
|
size_t size;
|
|
bool hasBeenDownloaded = false;
|
|
GraphicsAllocation *gfxAllocation = nullptr;
|
|
uint32_t bank = 0;
|
|
CommandStreamReceiver *csr = nullptr;
|
|
};
|
|
static std::unique_ptr<TbxPageFaultManager> create();
|
|
|
|
TbxPageFaultManager() = default;
|
|
|
|
using CpuPageFaultManager::insertAllocation;
|
|
using CpuPageFaultManager::removeAllocation;
|
|
void insertAllocation(CommandStreamReceiver *csr, GraphicsAllocation *alloc, uint32_t bank, void *ptr, size_t size) override;
|
|
void removeAllocation(GraphicsAllocation *alloc) override;
|
|
|
|
using CpuPageFaultManager::checkFaultHandlerFromPageFaultManager;
|
|
bool verifyAndHandlePageFault(void *ptr, bool handlePageFault) override;
|
|
|
|
protected:
|
|
void handlePageFault(void *ptr, PageFaultDataTbx &faultData);
|
|
|
|
std::unordered_map<void *, PageFaultDataTbx> memoryDataTbx;
|
|
SpinLock mtxTbx;
|
|
};
|
|
|
|
} // namespace NEO
|