feature: enable recoverable pagefault

Enabled recoverable pagefault and kmd migration support by
default for bmg and lnl, but disabled kmd migration for XeKMD
in order to disable kmd migration for all platforms using
XeKMD for now.

Related-To: NEO-13116
Signed-off-by: Young Jin Yoon <young.jin.yoon@intel.com>
This commit is contained in:
Young Jin Yoon
2025-01-21 02:58:28 +00:00
committed by Compute-Runtime-Automation
parent be0b2bd06d
commit 713df81dbf
10 changed files with 66 additions and 10 deletions

View File

@ -1134,7 +1134,9 @@ bool Drm::hasPageFaultSupport() const {
bool Drm::hasKmdMigrationSupport() const {
const auto &productHelper = this->getRootDeviceEnvironment().getHelper<ProductHelper>();
auto kmdMigrationSupported = hasPageFaultSupport() && productHelper.isKmdMigrationSupported();
auto kmdMigrationSupported = hasPageFaultSupport() &&
this->ioctlHelper->isKmdMigrationSupported() &&
productHelper.isKmdMigrationSupported();
if (debugManager.flags.UseKmdMigration.get() != -1) {
return !!debugManager.flags.UseKmdMigration.get();

View File

@ -139,6 +139,7 @@ class IoctlHelper {
virtual int execBuffer(ExecBuffer *execBuffer, uint64_t completionGpuAddress, TaskCountType counterValue) = 0;
virtual bool completionFenceExtensionSupported(const bool isVmBindAvailable) = 0;
virtual bool isPageFaultSupported() = 0;
virtual bool isKmdMigrationSupported() = 0;
virtual std::unique_ptr<uint8_t[]> createVmControlExtRegion(const std::optional<MemoryClassInstance> &regionInstanceClass) = 0;
virtual uint32_t getFlagsForVmCreate(bool disableScratch, bool enablePageFault, bool useVmBind) = 0;
virtual uint32_t createContextWithAccessCounters(GemContextCreateExt &gcc) = 0;
@ -272,6 +273,7 @@ class IoctlHelperI915 : public IoctlHelper {
bool setGpuCpuTimes(TimeStampData *pGpuCpuTime, OSTime *osTime) override;
void insertEngineToContextParams(ContextParamEngines<> &contextParamEngines, uint32_t engineId, const EngineClassInstance *engineClassInstance, uint32_t tileId, bool hasVirtualEngines) override;
int getTileIdFromGtId(int gtId) const override { return -1; }
bool isKmdMigrationSupported() override { return true; }
protected:
virtual std::vector<MemoryRegion> translateToMemoryRegions(const std::vector<uint64_t> &regionInfo);

View File

@ -947,10 +947,10 @@ int IoctlHelperXe::queryDistances(std::vector<QueryItem> &queryItems, std::vecto
}
bool IoctlHelperXe::isPageFaultSupported() {
xeLog(" -> IoctlHelperXe::%s %d\n", __FUNCTION__, false);
xeLog(" -> IoctlHelperXe::%s %d\n", __FUNCTION__, supportedFeatures.flags.pageFault == true);
return false;
};
return supportedFeatures.flags.pageFault;
}
uint32_t IoctlHelperXe::getEuStallFdParameter() {
xeLog(" -> IoctlHelperXe::%s\n", __FUNCTION__);

View File

@ -136,6 +136,7 @@ class IoctlHelperXe : public IoctlHelper {
int getTileIdFromGtId(int gtId) const override {
return gtIdToTileId[gtId];
}
bool isKmdMigrationSupported() override { return false; }
protected:
static constexpr uint32_t maxContextSetProperties = 4;

View File

@ -33,6 +33,16 @@ int ProductHelperHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, O
return 0;
}
template <>
bool ProductHelperHw<gfxProduct>::isPageFaultSupported() const {
return true;
}
template <>
bool ProductHelperHw<gfxProduct>::isKmdMigrationSupported() const {
return true;
}
template <>
bool ProductHelperHw<gfxProduct>::isDisableScratchPagesSupported() const {
return true;

View File

@ -35,6 +35,19 @@ int ProductHelperHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, O
return 0;
}
template <>
bool ProductHelperHw<gfxProduct>::isPageFaultSupported() const {
return true;
}
template <>
bool ProductHelperHw<gfxProduct>::isKmdMigrationSupported() const {
if (debugManager.flags.UseKmdMigration.get() != -1) {
return !!debugManager.flags.UseKmdMigration.get();
}
return false;
}
template <>
bool ProductHelperHw<gfxProduct>::isDisableScratchPagesSupported() const {
return true;

View File

@ -11,6 +11,7 @@
#include "shared/source/os_interface/product_helper.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h"
#include "shared/test/common/libult/linux/drm_query_mock.h"
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
#include "shared/test/common/mocks/linux/mock_os_context_linux.h"
#include "shared/test/common/mocks/linux/mock_os_time_linux.h"
@ -2596,3 +2597,24 @@ TEST_F(IoctlHelperXeTest, whenQueryDeviceIdAndRevisionThenProperValuesAreSet) {
EXPECT_EQ(mockDeviceId, hwInfo->platform.usDeviceID);
EXPECT_EQ(mockRevisionId, hwInfo->platform.usRevId);
}
TEST_F(IoctlHelperXeTest, givenUseKmdMigrationSetWhenCallingHasKmdMigrationSupportThenReturnCorrectValue) {
DebugManagerStateRestore restorer;
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->initializeMemoryManager();
DrmQueryMock drm(*executionEnvironment->rootDeviceEnvironments[0]);
drm.pageFaultSupported = true;
drm.ioctlHelper.reset(new IoctlHelperXe(drm));
for (auto useKmdMigration : {-1, 0, 1}) {
debugManager.flags.UseKmdMigration.set(useKmdMigration);
if (useKmdMigration == -1) {
EXPECT_FALSE(drm.hasKmdMigrationSupport());
} else {
EXPECT_EQ(useKmdMigration, drm.hasKmdMigrationSupport());
}
}
}

View File

@ -53,12 +53,16 @@ BMGTEST_F(BmgProductHelperLinux, givenProductHelperWhenAskedIfPatIndexProgrammin
EXPECT_TRUE(productHelper->isVmBindPatIndexProgrammingSupported());
}
BMGTEST_F(BmgProductHelperLinux, givenProductHelperWhenAskedIsPageFaultSupportedThenReturnFalse) {
EXPECT_FALSE(productHelper->isPageFaultSupported());
BMGTEST_F(BmgProductHelperLinux, givenProductHelperWhenCheckDirectSubmissionSupportedThenTrueIsReturned) {
EXPECT_TRUE(productHelper->isDirectSubmissionSupported(releaseHelper));
}
BMGTEST_F(BmgProductHelperLinux, givenProductHelperWhenAskedIsKmdMigrationSupportedThenReturnFalse) {
EXPECT_FALSE(productHelper->isKmdMigrationSupported());
BMGTEST_F(BmgProductHelperLinux, givenProductHelperWhenAskedIsPageFaultSupportedThenReturnTrue) {
EXPECT_TRUE(productHelper->isPageFaultSupported());
}
BMGTEST_F(BmgProductHelperLinux, givenProductHelperWhenAskedIsKmdMigrationSupportedThenReturnTrue) {
EXPECT_TRUE(productHelper->isKmdMigrationSupported());
}
BMGTEST_F(BmgProductHelperLinux, WhenGtIsSetupThenGtSystemInfoIsCorrect) {

View File

@ -36,3 +36,5 @@ HWTEST_EXCLUDE_PRODUCT(CommandEncodeSemaphore, givenIndirectModeSetWhenProgrammi
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenBooleanUncachedWhenCallOverridePatIndexThenProperPatIndexIsReturned, IGFX_XE2_HPG_CORE);
HWTEST_EXCLUDE_PRODUCT(GfxCoreHelperTest, whenEncodeAdditionalTimestampOffsetsThenNothingEncoded, IGFX_XE2_HPG_CORE);
HWTEST_EXCLUDE_PRODUCT(GfxCoreHelperTest, givenGetDeviceTimestampWidthCalledThenReturnCorrectValue, IGFX_XE2_HPG_CORE);
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenAskedIfPageFaultIsSupportedThenReturnFalse, IGFX_XE2_HPG_CORE);
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenAskedIfKmdMigrationIsSupportedThenReturnFalse, IGFX_XE2_HPG_CORE);

View File

@ -52,8 +52,8 @@ LNLTEST_F(LnlProductHelperLinux, givenProductHelperWhenAskedIfPatIndexProgrammin
EXPECT_TRUE(productHelper->isVmBindPatIndexProgrammingSupported());
}
LNLTEST_F(LnlProductHelperLinux, givenProductHelperWhenAskedIsPageFaultSupportedThenReturnFalse) {
EXPECT_FALSE(productHelper->isPageFaultSupported());
LNLTEST_F(LnlProductHelperLinux, givenProductHelperWhenAskedIsPageFaultSupportedThenReturnTrue) {
EXPECT_TRUE(productHelper->isPageFaultSupported());
}
LNLTEST_F(LnlProductHelperLinux, givenProductHelperWhenAskedIsKmdMigrationSupportedThenReturnFalse) {