fix: tbx page fault manager hang issue

- Updated `isAllocTbxFaultable` to exclude `gpuTimestampDeviceBuffer` from being
faultable.
- Replaced `SpinLock` with `RecursiveSpinLock` in `CpuPageFaultManager` and
`TbxPageFaultManager` to allow recursive locking.
- Added unit tests to verify the correct handling of `gpuTimestampDeviceBuffer`
in `TbxCommandStreamTests`.

Related-To: NEO-13748
Signed-off-by: Jack Myers <jack.myers@intel.com>
This commit is contained in:
Jack Myers
2025-02-03 18:04:37 +00:00
committed by Compute-Runtime-Automation
parent b7ba71df1c
commit 7d4e70a25b
12 changed files with 33 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -129,12 +129,18 @@ TEST(AubHelper, givenAllocationTypeWhenAskingIfOneTimeWritableThenReturnCorrectR
}
}
TEST(AubHelper, givenSetBufferHostMemoryAlwaysAubWritableWhenAskingIfBufferHostMemoryAllocationIsOneTimeAubWritableThenReturnCorrectResult) {
TEST(AubHelper, givenSetBufferHostMemoryAlwaysAubWritableAndDisabledTbxFaultMngrWhenAskingIfBufferHostMemoryAllocationIsOneTimeAubWritableThenReturnCorrectResult) {
DebugManagerStateRestore stateRestore;
NEO::debugManager.flags.EnableTbxPageFaultManager.set(0);
for (auto isAlwaysAubWritable : {false, true}) {
NEO::debugManager.flags.SetBufferHostMemoryAlwaysAubWritable.set(isAlwaysAubWritable);
EXPECT_NE(AubHelper::isOneTimeAubWritableAllocationType(AllocationType::bufferHostMemory), isAlwaysAubWritable);
for (auto isTbxFaultManagerEnabled : {false, true}) {
NEO::debugManager.flags.SetBufferHostMemoryAlwaysAubWritable.set(isAlwaysAubWritable);
NEO::debugManager.flags.EnableTbxPageFaultManager.set(isTbxFaultManagerEnabled);
bool isOneTimeAubWritable = AubHelper::isOneTimeAubWritableAllocationType(AllocationType::bufferHostMemory);
EXPECT_EQ(!isAlwaysAubWritable || isTbxFaultManagerEnabled, isOneTimeAubWritable);
}
}
}

View File

@@ -1589,8 +1589,12 @@ HWTEST_F(TbxCommandStreamTests, givenAubOneTimeWritableAllocWhenTbxFaultManagerI
for (const auto &allocType : onceWritableAllocTypesForTbx) {
gfxAlloc1->setAllocationType(allocType);
if (GraphicsAllocation::isLockable(allocType)) {
if (allocType == AllocationType::gpuTimestampDeviceBuffer) {
EXPECT_FALSE(tbxCsr->isAllocTbxFaultable(gfxAlloc1));
} else if (GraphicsAllocation::isLockable(allocType)) {
EXPECT_TRUE(tbxCsr->isAllocTbxFaultable(gfxAlloc1));
} else {
EXPECT_FALSE(tbxCsr->isAllocTbxFaultable(gfxAlloc1));
}
}