fix: read scratch page options during init
Previous logic to initialize scratch page options during Drm::create causes issues when PerContextVm is used, so moved the location of logic to be configured before creating VM. Related-To: GSD-7611 Signed-off-by: Young Jin Yoon <young.jin.yoon@intel.com>
This commit is contained in:
parent
0f0e7403bd
commit
1fc2a936fc
|
@ -14,6 +14,7 @@
|
||||||
#include "shared/source/os_interface/driver_info.h"
|
#include "shared/source/os_interface/driver_info.h"
|
||||||
#include "shared/source/os_interface/linux/allocator_helper.h"
|
#include "shared/source/os_interface/linux/allocator_helper.h"
|
||||||
#include "shared/source/os_interface/linux/i915.h"
|
#include "shared/source/os_interface/linux/i915.h"
|
||||||
|
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||||
#include "shared/source/os_interface/linux/sys_calls.h"
|
#include "shared/source/os_interface/linux/sys_calls.h"
|
||||||
#include "shared/source/os_interface/os_interface.h"
|
#include "shared/source/os_interface/os_interface.h"
|
||||||
#include "shared/test/common/helpers/custom_event_listener.h"
|
#include "shared/test/common/helpers/custom_event_listener.h"
|
||||||
|
@ -766,6 +767,28 @@ TEST_F(DrmTests, givenDrmIsCreatedWhenCreateVirtualMemoryFailsThenReturnVirtualM
|
||||||
::testing::internal::GetCapturedStdout();
|
::testing::internal::GetCapturedStdout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmTests, givenDrmIsCreatedWithPerContextVmRequiredWhenCreateVirtualMemoryThenCapturedVirtualMemoryIsSettingScratchPageOptionCorrectly) {
|
||||||
|
DebugManagerStateRestore dbgRestorer;
|
||||||
|
debugManager.flags.PrintDebugMessages.set(true);
|
||||||
|
debugManager.flags.DisableScratchPages.set(true);
|
||||||
|
debugManager.flags.GpuFaultCheckThreshold.set(10);
|
||||||
|
|
||||||
|
VariableBackup<decltype(captureVirtualMemoryCreate)> backupCaptureVirtualMemoryCreate(&captureVirtualMemoryCreate);
|
||||||
|
VariableBackup<decltype(capturedVmCreate)> backupCapturedVmCreate(&capturedVmCreate);
|
||||||
|
|
||||||
|
captureVirtualMemoryCreate = 1;
|
||||||
|
capturedVmCreate = {};
|
||||||
|
|
||||||
|
auto drm = DrmWrap::createDrm(*mockRootDeviceEnvironment);
|
||||||
|
EXPECT_NE(drm, nullptr);
|
||||||
|
|
||||||
|
auto disableScratch = drm.get()->checkToDisableScratchPage();
|
||||||
|
auto ioctlHelper = drm.get()->getIoctlHelper();
|
||||||
|
for (auto ctl : capturedVmCreate) {
|
||||||
|
EXPECT_NE(0u, (ctl.flags & ioctlHelper->getFlagsForVmCreate(disableScratch, false, false)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST(SysCalls, WhenSysCallsPollCalledThenCallIsRedirectedToOs) {
|
TEST(SysCalls, WhenSysCallsPollCalledThenCallIsRedirectedToOs) {
|
||||||
struct pollfd pollFd;
|
struct pollfd pollFd;
|
||||||
pollFd.fd = 0;
|
pollFd.fd = 0;
|
||||||
|
|
|
@ -41,6 +41,7 @@ int failOnVirtualMemoryCreate = 0;
|
||||||
int failOnSetPriority = 0;
|
int failOnSetPriority = 0;
|
||||||
int failOnPreemption = 0;
|
int failOnPreemption = 0;
|
||||||
int failOnDrmVersion = 0;
|
int failOnDrmVersion = 0;
|
||||||
|
int captureVirtualMemoryCreate = 0;
|
||||||
int accessCalledTimes = 0;
|
int accessCalledTimes = 0;
|
||||||
int readLinkCalledTimes = 0;
|
int readLinkCalledTimes = 0;
|
||||||
int fstatCalledTimes = 0;
|
int fstatCalledTimes = 0;
|
||||||
|
@ -49,6 +50,7 @@ char providedDrmVersion[5] = {'i', '9', '1', '5', '\0'};
|
||||||
uint64_t gpuTimestamp = 0;
|
uint64_t gpuTimestamp = 0;
|
||||||
int ioctlSeq[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
int ioctlSeq[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
size_t ioctlCnt = 0;
|
size_t ioctlCnt = 0;
|
||||||
|
std::vector<NEO::GemVmControl> capturedVmCreate{};
|
||||||
|
|
||||||
int fstat(int fd, struct stat *buf) {
|
int fstat(int fd, struct stat *buf) {
|
||||||
++fstatCalledTimes;
|
++fstatCalledTimes;
|
||||||
|
@ -234,6 +236,9 @@ int drmVirtualMemoryCreate(NEO::GemVmControl *control) {
|
||||||
if (!failOnVirtualMemoryCreate) {
|
if (!failOnVirtualMemoryCreate) {
|
||||||
control->vmId = ++vmId;
|
control->vmId = ++vmId;
|
||||||
}
|
}
|
||||||
|
if (captureVirtualMemoryCreate) {
|
||||||
|
capturedVmCreate.push_back(*control);
|
||||||
|
}
|
||||||
return failOnVirtualMemoryCreate;
|
return failOnVirtualMemoryCreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "shared/source/os_interface/linux/drm_wrappers.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
@ -16,6 +18,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
extern int (*openFunc)(const char *pathname, int flags, ...);
|
extern int (*openFunc)(const char *pathname, int flags, ...);
|
||||||
extern int (*openFull)(const char *pathname, int flags, ...);
|
extern int (*openFull)(const char *pathname, int flags, ...);
|
||||||
|
@ -38,6 +41,7 @@ extern int failOnSetPriority;
|
||||||
extern int failOnPreemption;
|
extern int failOnPreemption;
|
||||||
extern int havePreemption;
|
extern int havePreemption;
|
||||||
extern int failOnDrmVersion;
|
extern int failOnDrmVersion;
|
||||||
|
extern int captureVirtualMemoryCreate;
|
||||||
extern char providedDrmVersion[5];
|
extern char providedDrmVersion[5];
|
||||||
extern int ioctlSeq[8];
|
extern int ioctlSeq[8];
|
||||||
extern size_t ioctlCnt;
|
extern size_t ioctlCnt;
|
||||||
|
@ -47,3 +51,4 @@ extern int accessCalledTimes;
|
||||||
extern int readLinkCalledTimes;
|
extern int readLinkCalledTimes;
|
||||||
extern int fstatCalledTimes;
|
extern int fstatCalledTimes;
|
||||||
extern bool forceExtraIoctlDuration;
|
extern bool forceExtraIoctlDuration;
|
||||||
|
extern std::vector<NEO::GemVmControl> capturedVmCreate;
|
||||||
|
|
|
@ -98,6 +98,9 @@ Drm *Drm::create(std::unique_ptr<HwDeviceIdDrm> &&hwDeviceId, RootDeviceEnvironm
|
||||||
drm->isSetPairAvailable();
|
drm->isSetPairAvailable();
|
||||||
drm->isChunkingAvailable();
|
drm->isChunkingAvailable();
|
||||||
|
|
||||||
|
drm->configureScratchPagePolicy();
|
||||||
|
drm->configureGpuFaultCheckThreshold();
|
||||||
|
|
||||||
if (!drm->isPerContextVMRequired()) {
|
if (!drm->isPerContextVMRequired()) {
|
||||||
if (!drm->createVirtualMemoryAddressSpace(GfxCoreHelper::getSubDevicesCount(rootDeviceEnvironment.getHardwareInfo()))) {
|
if (!drm->createVirtualMemoryAddressSpace(GfxCoreHelper::getSubDevicesCount(rootDeviceEnvironment.getHardwareInfo()))) {
|
||||||
printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "INFO: Device doesn't support GEM Virtual Memory\n");
|
printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "INFO: Device doesn't support GEM Virtual Memory\n");
|
||||||
|
@ -106,9 +109,6 @@ Drm *Drm::create(std::unique_ptr<HwDeviceIdDrm> &&hwDeviceId, RootDeviceEnvironm
|
||||||
|
|
||||||
drm->queryAdapterBDF();
|
drm->queryAdapterBDF();
|
||||||
|
|
||||||
drm->configureScratchPagePolicy();
|
|
||||||
drm->configureGpuFaultCheckThreshold();
|
|
||||||
|
|
||||||
return drm.release();
|
return drm.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue