From c01a5c45c70fe51e31cd3f367268c37395e86ad1 Mon Sep 17 00:00:00 2001 From: Young Jin Yoon Date: Fri, 19 Jul 2024 19:18:23 +0000 Subject: [PATCH] fix: wait on userfence when VM immediate is used Removed if condition when calling vm_bind in order to reflect changed in KMD. Specifically, dii-4347 to dii-4349 include changes on strict fence ordering on vm_bind, where user fence has to be inserted regardless of using pagefault or explicit residency. Related-To: NEO-11966 Signed-off-by: Young Jin Yoon --- shared/source/os_interface/linux/drm_neo.cpp | 11 ++++------- .../os_interface/linux/drm_vm_bind_prelim_tests.cpp | 8 ++------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/shared/source/os_interface/linux/drm_neo.cpp b/shared/source/os_interface/linux/drm_neo.cpp index acde26d614..04fc5043c1 100644 --- a/shared/source/os_interface/linux/drm_neo.cpp +++ b/shared/source/os_interface/linux/drm_neo.cpp @@ -1418,13 +1418,10 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI if (ioctlHelper->isWaitBeforeBindRequired(bind)) { if (drm->useVMBindImmediate()) { lock = drm->lockBindFenceMutex(); - - if (!drm->hasPageFaultSupport() || bo->isExplicitResidencyRequired()) { - auto nextExtension = vmBind.extensions; - incrementFenceValue = true; - programUserFence(drm, osContext, bo, vmBindExtUserFence, vmHandleId, nextExtension); - ioctlHelper->setVmBindUserFence(vmBind, vmBindExtUserFence); - } + auto nextExtension = vmBind.extensions; + incrementFenceValue = true; + programUserFence(drm, osContext, bo, vmBindExtUserFence, vmHandleId, nextExtension); + ioctlHelper->setVmBindUserFence(vmBind, vmBindExtUserFence); } } if (bind) { diff --git a/shared/test/unit_test/os_interface/linux/drm_vm_bind_prelim_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_vm_bind_prelim_tests.cpp index da55996fa3..9405e596f2 100644 --- a/shared/test/unit_test/os_interface/linux/drm_vm_bind_prelim_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_vm_bind_prelim_tests.cpp @@ -119,7 +119,7 @@ TEST(DrmVmBindTest, givenPerContextVmsAndBoRequiringExplicitResidencyWhenBinding } } -TEST(DrmVmBindTest, givenBoNotRequiringExplicitResidencyWhenCallingWaitForBindThenDontWaitOnUserFence) { +TEST(DrmVmBindTest, whenCallingWaitForBindThenWaitUserFenceIsCalled) { auto executionEnvironment = std::make_unique(); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); executionEnvironment->initializeMemoryManager(); @@ -148,11 +148,7 @@ TEST(DrmVmBindTest, givenBoNotRequiringExplicitResidencyWhenCallingWaitForBindTh drm.waitForBind(vmHandleId); - if (requireResidency) { - EXPECT_TRUE(drm.waitUserFenceCalled); - } else { - EXPECT_FALSE(drm.waitUserFenceCalled); - } + EXPECT_TRUE(drm.waitUserFenceCalled); } }