diff --git a/shared/source/device/device.cpp b/shared/source/device/device.cpp index 4568a14048..bde8228e6d 100644 --- a/shared/source/device/device.cpp +++ b/shared/source/device/device.cpp @@ -138,9 +138,7 @@ bool Device::createDeviceImpl() { } // initialize common resources once - if (!initializeCommonResources()) { - return false; - } + initializeCommonResources(); } // create engines @@ -174,14 +172,15 @@ bool Device::initDeviceWithEngines() { return createEngines(); } -bool Device::initializeCommonResources() { +void Device::initializeCommonResources() { if (getExecutionEnvironment()->isDebuggingEnabled()) { const auto rootDeviceIndex = getRootDeviceIndex(); auto rootDeviceEnvironment = getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex].get(); rootDeviceEnvironment->initDebuggerL0(this); if (rootDeviceEnvironment->debugger == nullptr) { - NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Debug mode is not enabled in the system.\n"); - return false; + NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, + "Debug mode is not enabled in the system.\n"); + getExecutionEnvironment()->setDebuggingMode(DebuggingMode::disabled); } } @@ -210,7 +209,6 @@ bool Device::initializeCommonResources() { deviceUsmMemAllocPoolsManager.reset(new UsmMemAllocPoolsManager(getMemoryManager(), rootDeviceIndices, deviceBitfields, this, InternalMemoryType::deviceUnifiedMemory)); } initUsmReuseMaxSize(); - return true; } void Device::initUsmReuseMaxSize() { diff --git a/shared/source/device/device.h b/shared/source/device/device.h index 11a731c0c9..b9c9822973 100644 --- a/shared/source/device/device.h +++ b/shared/source/device/device.h @@ -277,7 +277,7 @@ class Device : public ReferenceTrackedObject, NEO::NonCopyableAndNonMova MOCKABLE_VIRTUAL bool createDeviceImpl(); bool initDeviceWithEngines(); - bool initializeCommonResources(); + void initializeCommonResources(); bool initDeviceFully(); void initUsmReuseMaxSize(); virtual bool createEngines(); diff --git a/shared/source/dll/linux/debugger_l0_dll_linux.cpp b/shared/source/dll/linux/debugger_l0_dll_linux.cpp index a0f109f21c..ed7375875a 100644 --- a/shared/source/dll/linux/debugger_l0_dll_linux.cpp +++ b/shared/source/dll/linux/debugger_l0_dll_linux.cpp @@ -19,12 +19,7 @@ std::unique_ptr DebuggerL0::create(NEO::Device *device) { return nullptr; } auto osInterface = device->getRootDeviceEnvironment().osInterface.get(); - if (!osInterface) { - return nullptr; - } - if (!osInterface->isDebugAttachAvailable()) { - auto cardName = osInterface->getDriverModel()->as()->getSysFsPciPathBaseName(); - IoFunctions::fprintf(stderr, "Kernel debug mode is not enabled for %s. Device is not available for use\n", cardName.c_str()); + if (!osInterface || !osInterface->isDebugAttachAvailable()) { return nullptr; } diff --git a/shared/source/os_interface/linux/drm_neo.cpp b/shared/source/os_interface/linux/drm_neo.cpp index c441f99b41..661c4b9888 100644 --- a/shared/source/os_interface/linux/drm_neo.cpp +++ b/shared/source/os_interface/linux/drm_neo.cpp @@ -179,15 +179,6 @@ int Drm::getEnabledPooledEu(int &enabled) { return getParamIoctl(DrmParam::paramHasPooledEu, &enabled); } -std::string Drm::getSysFsPciPathBaseName() { - auto fullPath = getSysFsPciPath(); - size_t pos = fullPath.rfind("/"); - if (std::string::npos == pos) { - return fullPath; - } - return fullPath.substr(pos + 1, std::string::npos); -} - std::string Drm::getSysFsPciPath() { std::string path = std::string(Os::sysFsPciPathPrefix) + hwDeviceId->getPciPath() + "/drm"; std::string expectedFilePrefix = path + "/card"; diff --git a/shared/source/os_interface/linux/drm_neo.h b/shared/source/os_interface/linux/drm_neo.h index c17f10e3f5..c7f10f374a 100644 --- a/shared/source/os_interface/linux/drm_neo.h +++ b/shared/source/os_interface/linux/drm_neo.h @@ -264,7 +264,6 @@ class Drm : public DriverModel { void cleanup() override; bool readSysFsAsString(const std::string &relativeFilePath, std::string &readString); MOCKABLE_VIRTUAL std::string getSysFsPciPath(); - MOCKABLE_VIRTUAL std::string getSysFsPciPathBaseName(); std::unique_ptr &getHwDeviceId() { return hwDeviceId; } template diff --git a/shared/test/unit_test/device/neo_device_tests.cpp b/shared/test/unit_test/device/neo_device_tests.cpp index f6193ab364..8d40994bdf 100644 --- a/shared/test/unit_test/device/neo_device_tests.cpp +++ b/shared/test/unit_test/device/neo_device_tests.cpp @@ -1983,7 +1983,7 @@ TEST_F(DeviceTests, GivenDebuggingEnabledWhenDeviceIsInitializedThenL0DebuggerIs EXPECT_NE(nullptr, device->getL0Debugger()); } -TEST_F(DeviceTests, givenDebuggerRequestedByUserAndNotAvailableWhenDeviceIsInitializedThenDeviceIsNullAndErrorIsPrinted) { +TEST_F(DeviceTests, givenDebuggerRequestedByUserAndNotAvailableWhenDeviceIsInitializedThenErrorIsPrintedButNotReturned) { extern bool forceCreateNullptrDebugger; VariableBackup backupForceCreateNullptrDebugger{&forceCreateNullptrDebugger, true}; @@ -1998,7 +1998,7 @@ TEST_F(DeviceTests, givenDebuggerRequestedByUserAndNotAvailableWhenDeviceIsIniti auto output = testing::internal::GetCapturedStderr(); EXPECT_EQ(std::string("Debug mode is not enabled in the system.\n"), output); - EXPECT_EQ(nullptr, device); + EXPECT_EQ(nullptr, device->getL0Debugger()); } TEST_F(DeviceTests, givenDebuggerRequestedByUserWhenDeviceWithSubDevicesCreatedThenInitializeDebuggerOncePerRootDevice) { diff --git a/shared/test/unit_test/os_interface/linux/drm_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_tests.cpp index 66f5600a51..d5d3e3cccb 100644 --- a/shared/test/unit_test/os_interface/linux/drm_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_tests.cpp @@ -2267,20 +2267,3 @@ TEST(DrmTest, GivenProductSpecificIoctlHelperAvailableAndDebugFlagToIgnoreIsSetW EXPECT_EQ(0u, customFuncCalled); } - -TEST(DrmTest, GivenSysFsPciPathWhenCallinggetSysFsPciPathBaseNameThenResultIsCorrect) { - auto executionEnvironment = std::make_unique(); - - class DrmMockPciPath : public DrmMock { - public: - DrmMockPciPath(RootDeviceEnvironment &rootDeviceEnvironment) : DrmMock(rootDeviceEnvironment) {} - std::string mockSysFsPciPath = "/sys/devices/pci0000:00/0000:00:02.0/drm/card0"; - std::string getSysFsPciPath() override { return mockSysFsPciPath; } - }; - DrmMockPciPath drm{*executionEnvironment->rootDeviceEnvironments[0]}; - EXPECT_STREQ("card0", drm.getSysFsPciPathBaseName().c_str()); - drm.mockSysFsPciPath = "/sys/devices/pci0000:00/0000:00:02.0/drm/card7"; - EXPECT_STREQ("card7", drm.getSysFsPciPathBaseName().c_str()); - drm.mockSysFsPciPath = "card8"; - EXPECT_STREQ("card8", drm.getSysFsPciPathBaseName().c_str()); -} \ No newline at end of file