Revert "fix: unblock xekmd recoverable pagefaults vmbind"

This reverts commit 5e144dae16.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2024-06-25 17:46:37 +02:00
committed by Compute-Runtime-Automation
parent a3c3b6533a
commit 2800282bdb
16 changed files with 72 additions and 260 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);
@@ -97,7 +91,5 @@ class MockIoctlHelper : public IoctlHelperPrelim20 {
uint32_t allocateInterruptCalled = 0;
uint32_t releaseInterruptCalled = 0;
uint32_t latestReleaseInterruptHandle = InterruptId::notUsed;
bool callBaseVmAdviseAtomicAttribute = true;
std::optional<uint32_t> vmAdviseAtomicAttribute{};
};
} // namespace NEO

View File

@@ -7799,24 +7799,3 @@ TEST_F(DrmMemoryManagerTest, givenDebugVariableToToggleGpuVaBitsWhenAllocatingRe
memoryManager->freeGraphicsMemory(allocation);
}
}
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);
mockIoctlHelper->callBaseVmAdviseAtomicAttribute = false;
mockIoctlHelper->vmAdviseAtomicAttribute = 0;
AllocationData allocationData{};
allocationData.size = MemoryConstants::cacheLineSize;
allocationData.rootDeviceIndex = mockRootDeviceIndex;
allocationData.alignment = MemoryConstants::pageSize;
auto sharedUSM = memoryManager->createSharedUnifiedMemoryAllocation(allocationData);
EXPECT_EQ(nullptr, 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

@@ -9,7 +9,6 @@ set(NEO_CORE_OS_INTERFACE_TESTS_LINUX_XE
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/ioctl_helper_xe_perf_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe_tests.h
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe_query_features_tests.cpp
)
if(NEO_ENABLE_XE_EU_DEBUG_SUPPORT)
list(APPEND NEO_CORE_OS_INTERFACE_TESTS_LINUX_XE

View File

@@ -1,44 +0,0 @@
/*
* Copyright (C) 2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.h"
class DrmMockXeQueryFeatures : public DrmMockXe {
public:
using DrmMockXe::DrmMockXe;
int ioctl(DrmIoctl request, void *arg) override {
switch (request) {
case DrmIoctl::gemVmCreate: {
auto vmCreate = static_cast<drm_xe_vm_create *>(arg);
if ((vmCreate->flags & DRM_XE_VM_CREATE_FLAG_FAULT_MODE) == DRM_XE_VM_CREATE_FLAG_FAULT_MODE &&
(vmCreate->flags & DRM_XE_VM_CREATE_FLAG_LR_MODE) == DRM_XE_VM_CREATE_FLAG_LR_MODE &&
(!supportsRecoverablePageFault)) {
return -EINVAL;
}
return 0;
} break;
default:
return DrmMockXe::ioctl(request, arg);
}
};
bool supportsRecoverablePageFault = true;
};
TEST(IoctlHelperXeQueryFeaturesTest, whenInitializeIoctlHelperThenQueryRecoverablePageFaultSupport) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMockXeQueryFeatures drm{*executionEnvironment->rootDeviceEnvironments[0]};
for (const auto &recoverablePageFault : ::testing::Bool()) {
drm.supportsRecoverablePageFault = recoverablePageFault;
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
xeIoctlHelper->initialize();
EXPECT_EQ(xeIoctlHelper->supportedFeatures.flags.pageFault, recoverablePageFault);
}
}

View File

@@ -256,9 +256,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());
@@ -279,7 +279,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({}));
@@ -298,7 +298,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe
EXPECT_EQ(std::nullopt, xeIoctlHelper->getCopyClassSaturateLinkCapability());
EXPECT_EQ(std::nullopt, xeIoctlHelper->getVmAdviseAtomicAttribute());
EXPECT_EQ(0u, xeIoctlHelper->getVmAdviseAtomicAttribute());
VmBindParams vmBindParams{};
EXPECT_EQ(-1, xeIoctlHelper->vmBind(vmBindParams));
@@ -1606,37 +1606,6 @@ TEST(IoctlHelperXeTest, givenVmBindWaitUserFenceTimeoutWhenCallingVmBindThenWait
}
}
TEST(IoctlHelperXeTest, whenCallingVmBindAndUnbindWithNoResidencyRequiredThenWaitUserFenceIsNotCalled) {
DebugManagerStateRestore restorer;
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMockXe drm{*executionEnvironment->rootDeviceEnvironments[0]};
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
BindInfo mockBindInfo{};
mockBindInfo.handle = 0x1234;
xeIoctlHelper->bindInfo.push_back(mockBindInfo);
VmBindParams vmBindParams{};
vmBindParams.handle = mockBindInfo.handle;
drm.vmBindInputs.clear();
drm.syncInputs.clear();
drm.waitUserFenceInputs.clear();
EXPECT_EQ(0, xeIoctlHelper->vmBind(vmBindParams));
EXPECT_EQ(1u, drm.vmBindInputs.size());
EXPECT_EQ(0u, drm.syncInputs.size());
EXPECT_EQ(0u, drm.waitUserFenceInputs.size());
drm.vmBindInputs.clear();
drm.syncInputs.clear();
drm.waitUserFenceInputs.clear();
EXPECT_EQ(0, xeIoctlHelper->vmUnbind(vmBindParams));
EXPECT_EQ(1u, drm.vmBindInputs.size());
EXPECT_EQ(0u, drm.syncInputs.size());
EXPECT_EQ(0u, drm.waitUserFenceInputs.size());
}
TEST(IoctlHelperXeTest, whenGemVmBindFailsThenErrorIsPropagated) {
DebugManagerStateRestore restorer;
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
@@ -2050,7 +2019,6 @@ TEST(IoctlHelperXeTest, givenMultipleBindInfosWhenVmBindIsCalledThenProperHandle
MockIoctlHelperXe::UserFenceExtension userFence{};
userFence.tag = userFence.tagValue;
userFence.addr = 0x1;
VmBindParams vmBindParams{};
vmBindParams.userFence = castToUint64(&userFence);
vmBindParams.handle = 0;