Revert "fix: unblock xekmd recoverable pagefaults vmbind"

This reverts commit 8f4472a26c.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2024-07-23 16:18:39 +02:00
committed by Compute-Runtime-Automation
parent 9b3ccf73b7
commit ae68df3832
13 changed files with 47 additions and 163 deletions

View File

@@ -56,12 +56,6 @@ class MockIoctlHelper : public IoctlHelperPrelim20 {
return IoctlHelperPrelim20::isWaitBeforeBindRequired(bind);
}
std::optional<uint32_t> getVmAdviseAtomicAttribute() override {
if (callBaseVmAdviseAtomicAttribute)
return IoctlHelperPrelim20::getVmAdviseAtomicAttribute();
return vmAdviseAtomicAttribute;
}
bool allocateInterrupt(uint32_t &handle) override {
allocateInterruptCalled++;
return IoctlHelperPrelim20::allocateInterrupt(handle);
@@ -108,7 +102,5 @@ class MockIoctlHelper : public IoctlHelperPrelim20 {
uint32_t latestReleaseInterruptHandle = InterruptId::notUsed;
uint32_t createMediaContextCalled = 0;
uint32_t releaseMediaContextCalled = 0;
bool callBaseVmAdviseAtomicAttribute = true;
std::optional<uint32_t> vmAdviseAtomicAttribute{};
};
} // namespace NEO

View File

@@ -7941,53 +7941,4 @@ TEST_F(DrmMemoryManagerTest, givenUsmCompressionSupportedThenReturnFalse) {
debugManager.flags.RenderCompressedBuffersEnabled.set(1);
EXPECT_TRUE(memoryManager->usmCompressionSupported(device));
}
TEST_F(DrmMemoryManagerTest, givenVmAdviseAtomicAttributeEqualZeroWhenCreateSharedUnifiedMemoryAllocationIsCalledThenNullptrReturned) {
std::vector<MemoryRegion> regionInfo(1);
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
auto &drm = static_cast<DrmMockCustom &>(memoryManager->getDrm(mockRootDeviceIndex));
auto mockIoctlHelper = new MockIoctlHelper(*mock);
drm.memoryInfo.reset(new MemoryInfo(regionInfo, drm));
drm.ioctlHelper.reset(mockIoctlHelper);
AllocationData allocationData{};
allocationData.size = MemoryConstants::cacheLineSize;
allocationData.rootDeviceIndex = mockRootDeviceIndex;
allocationData.alignment = MemoryConstants::pageSize;
mockIoctlHelper->callBaseVmAdviseAtomicAttribute = false;
mockIoctlHelper->vmAdviseAtomicAttribute = 0;
auto sharedUSM = memoryManager->createSharedUnifiedMemoryAllocation(allocationData);
EXPECT_EQ(nullptr, sharedUSM);
}
TEST_F(DrmMemoryManagerTest, givenVmAdviseAtomicAttributeNotPresentWhenCreateSharedUnifiedMemoryAllocationIsCalledThenAllocationIsCreatedSuccessfully) {
mock->ioctlExpected.gemWait = 1;
mock->ioctlExpected.gemClose = 1;
mock->ioctlExpected.gemCreateExt = 1;
mock->ioctlExpected.gemMmapOffset = 1;
std::vector<MemoryRegion> regionInfo(1);
regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0};
auto &drm = static_cast<DrmMockCustom &>(memoryManager->getDrm(mockRootDeviceIndex));
auto mockIoctlHelper = new MockIoctlHelper(*mock);
drm.memoryInfo.reset(new MemoryInfo(regionInfo, drm));
drm.ioctlHelper.reset(mockIoctlHelper);
AllocationData allocationData{};
allocationData.size = MemoryConstants::cacheLineSize;
allocationData.rootDeviceIndex = mockRootDeviceIndex;
allocationData.alignment = MemoryConstants::pageSize;
mockIoctlHelper->callBaseVmAdviseAtomicAttribute = false;
mockIoctlHelper->vmAdviseAtomicAttribute = std::nullopt;
auto sharedUSM = memoryManager->createSharedUnifiedMemoryAllocation(allocationData);
EXPECT_NE(nullptr, sharedUSM);
memoryManager->freeGraphicsMemory(sharedUSM);
}
}

View File

@@ -342,48 +342,6 @@ TEST(DrmQueryTest, givenPageFaultSupportEnabledWhenCallingQueryPageFaultSupportT
}
}
TEST(DrmQueryTest, givenPrintIoctlDebugFlagSetWhenCallingQueryPageFaultSupportThenCaptureExpectedOutput) {
DebugManagerStateRestore restore;
debugManager.flags.PrintIoctlEntries.set(true);
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
const auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper<ProductHelper>();
bool hasPageFaultSupport = true;
drm.context.hasPageFaultQueryValue = hasPageFaultSupport;
testing::internal::CaptureStdout(); // start capturing
drm.queryPageFaultSupport();
debugManager.flags.PrintIoctlEntries.set(false);
std::string outputString = testing::internal::GetCapturedStdout(); // stop capturing
if (productHelper.isPageFaultSupported()) {
std::string expectedString = "DRM_IOCTL_I915_GETPARAM: param: PRELIM_I915_PARAM_HAS_PAGE_FAULT, output value: 1, retCode: 0\n";
EXPECT_NE(std::string::npos, outputString.find(expectedString));
} else {
EXPECT_TRUE(outputString.empty());
}
}
TEST(DrmQueryTest, givenPrintIoctlDebugFlagNotSetWhenIsPageFaultSupportedCalledThenNoCapturedOutput) {
DebugManagerStateRestore restore;
debugManager.flags.PrintIoctlEntries.set(false);
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
bool hasPageFaultSupport = true;
drm.context.hasPageFaultQueryValue = hasPageFaultSupport;
testing::internal::CaptureStdout(); // start capturing
drm.queryPageFaultSupport();
debugManager.flags.PrintIoctlEntries.set(false);
std::string outputString = testing::internal::GetCapturedStdout(); // stop capturing
EXPECT_TRUE(outputString.empty());
}
TEST(DrmQueryTest, WhenQueryPageFaultSupportFailsThenReturnFalse) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};

View File

@@ -257,9 +257,9 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe
EXPECT_EQ(std::nullopt, xeIoctlHelper->getPreferredLocationRegion(PreferredLocation::none, 0));
EXPECT_TRUE(xeIoctlHelper->setVmBoAdvise(0, 0, nullptr));
EXPECT_FALSE(xeIoctlHelper->setVmBoAdvise(0, 0, nullptr));
EXPECT_TRUE(xeIoctlHelper->setVmBoAdviseForChunking(0, 0, 0, 0, nullptr));
EXPECT_FALSE(xeIoctlHelper->setVmBoAdviseForChunking(0, 0, 0, 0, nullptr));
EXPECT_FALSE(xeIoctlHelper->isChunkingAvailable());
@@ -280,7 +280,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe
EXPECT_FALSE(xeIoctlHelper->completionFenceExtensionSupported(false));
EXPECT_EQ(false, xeIoctlHelper->isPageFaultSupported());
EXPECT_EQ(std::nullopt, xeIoctlHelper->getHasPageFaultParamId());
EXPECT_EQ(nullptr, xeIoctlHelper->createVmControlExtRegion({}));
@@ -295,7 +295,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe
VmBindExtUserFenceT vmBindExtUserFence{};
EXPECT_NO_THROW(xeIoctlHelper->fillVmBindExtUserFence(vmBindExtUserFence, 0, 0, 0));
EXPECT_EQ(std::nullopt, xeIoctlHelper->getVmAdviseAtomicAttribute());
EXPECT_EQ(0u, xeIoctlHelper->getVmAdviseAtomicAttribute());
VmBindParams vmBindParams{};
EXPECT_EQ(-1, xeIoctlHelper->vmBind(vmBindParams));
@@ -2027,7 +2027,6 @@ TEST(IoctlHelperXeTest, givenMultipleBindInfosWhenVmBindIsCalledThenProperHandle
MockIoctlHelperXe::UserFenceExtension userFence{};
userFence.tag = userFence.tagValue;
userFence.addr = 0x1;
VmBindParams vmBindParams{};
vmBindParams.userFence = castToUint64(&userFence);
vmBindParams.handle = 0;