mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Retry calling ioctl when getting -EBUSY from ioctl call
Related-To: NEO-7195 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
a7af94496b
commit
f42e012bd8
@ -108,7 +108,7 @@ int Drm::ioctl(DrmIoctl request, void *arg) {
|
||||
}
|
||||
}
|
||||
|
||||
} while (ret == -1 && (returnedErrno == EINTR || returnedErrno == EAGAIN || returnedErrno == EBUSY));
|
||||
} while (ret == -1 && (returnedErrno == EINTR || returnedErrno == EAGAIN || returnedErrno == EBUSY || returnedErrno == -EBUSY));
|
||||
SYSTEM_LEAVE(request);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1263,6 +1263,29 @@ TEST(DrmTest, GivenCompletionFenceDebugFlagWhenCreatingDrmObjectThenExpectCorrec
|
||||
EXPECT_FALSE(drmDisabled.completionFenceSupport());
|
||||
}
|
||||
|
||||
TEST(DrmTest, GivenMinusEbusyIoctlErrorWhenCallingExecbufferThenCallIoctlAgain) {
|
||||
ExecutionEnvironment executionEnvironment{};
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
|
||||
DrmMock drm{*executionEnvironment.rootDeviceEnvironments[0]};
|
||||
|
||||
VariableBackup<decltype(SysCalls::sysCallsIoctl)> mockIoctl(&SysCalls::sysCallsIoctl);
|
||||
VariableBackup<int> mockErrno(&errno);
|
||||
|
||||
SysCalls::sysCallsIoctl = [](int fileDescriptor, unsigned long int request, void *arg) -> int {
|
||||
static int ioctlCount;
|
||||
ioctlCount++;
|
||||
if (ioctlCount == 1) {
|
||||
errno = -EBUSY;
|
||||
return -1;
|
||||
}
|
||||
ioctlCount = 0;
|
||||
return 0;
|
||||
};
|
||||
|
||||
EXPECT_EQ(0, drm.Drm::ioctl(DrmIoctl::GemExecbuffer2, nullptr));
|
||||
}
|
||||
|
||||
TEST(DrmTest, GivenIoctlErrorWhenIsGpuHangIsCalledThenErrorIsThrown) {
|
||||
ExecutionEnvironment executionEnvironment{};
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
|
Reference in New Issue
Block a user