Skip to content

Commit 6ee39ed

Browse files
Revert "fix: Fail device init if kernel debugging is misconfigured"
This reverts commit b0c92ea. Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
1 parent 406048f commit 6ee39ed

File tree

7 files changed

+9
-43
lines changed

7 files changed

+9
-43
lines changed

shared/source/device/device.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,7 @@ bool Device::createDeviceImpl() {
138138
}
139139

140140
// initialize common resources once
141-
if (!initializeCommonResources()) {
142-
return false;
143-
}
141+
initializeCommonResources();
144142
}
145143

146144
// create engines
@@ -174,14 +172,15 @@ bool Device::initDeviceWithEngines() {
174172
return createEngines();
175173
}
176174

177-
bool Device::initializeCommonResources() {
175+
void Device::initializeCommonResources() {
178176
if (getExecutionEnvironment()->isDebuggingEnabled()) {
179177
const auto rootDeviceIndex = getRootDeviceIndex();
180178
auto rootDeviceEnvironment = getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex].get();
181179
rootDeviceEnvironment->initDebuggerL0(this);
182180
if (rootDeviceEnvironment->debugger == nullptr) {
183-
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Debug mode is not enabled in the system.\n");
184-
return false;
181+
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
182+
"Debug mode is not enabled in the system.\n");
183+
getExecutionEnvironment()->setDebuggingMode(DebuggingMode::disabled);
185184
}
186185
}
187186

@@ -210,7 +209,6 @@ bool Device::initializeCommonResources() {
210209
deviceUsmMemAllocPoolsManager.reset(new UsmMemAllocPoolsManager(getMemoryManager(), rootDeviceIndices, deviceBitfields, this, InternalMemoryType::deviceUnifiedMemory));
211210
}
212211
initUsmReuseMaxSize();
213-
return true;
214212
}
215213

216214
void Device::initUsmReuseMaxSize() {

shared/source/device/device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class Device : public ReferenceTrackedObject<Device>, NEO::NonCopyableAndNonMova
277277

278278
MOCKABLE_VIRTUAL bool createDeviceImpl();
279279
bool initDeviceWithEngines();
280-
bool initializeCommonResources();
280+
void initializeCommonResources();
281281
bool initDeviceFully();
282282
void initUsmReuseMaxSize();
283283
virtual bool createEngines();

shared/source/dll/linux/debugger_l0_dll_linux.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ std::unique_ptr<NEO::Debugger> DebuggerL0::create(NEO::Device *device) {
1919
return nullptr;
2020
}
2121
auto osInterface = device->getRootDeviceEnvironment().osInterface.get();
22-
if (!osInterface) {
23-
return nullptr;
24-
}
25-
if (!osInterface->isDebugAttachAvailable()) {
26-
auto cardName = osInterface->getDriverModel()->as<Drm>()->getSysFsPciPathBaseName();
27-
IoFunctions::fprintf(stderr, "Kernel debug mode is not enabled for %s. Device is not available for use\n", cardName.c_str());
22+
if (!osInterface || !osInterface->isDebugAttachAvailable()) {
2823
return nullptr;
2924
}
3025

shared/source/os_interface/linux/drm_neo.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,6 @@ int Drm::getEnabledPooledEu(int &enabled) {
179179
return getParamIoctl(DrmParam::paramHasPooledEu, &enabled);
180180
}
181181

182-
std::string Drm::getSysFsPciPathBaseName() {
183-
auto fullPath = getSysFsPciPath();
184-
size_t pos = fullPath.rfind("/");
185-
if (std::string::npos == pos) {
186-
return fullPath;
187-
}
188-
return fullPath.substr(pos + 1, std::string::npos);
189-
}
190-
191182
std::string Drm::getSysFsPciPath() {
192183
std::string path = std::string(Os::sysFsPciPathPrefix) + hwDeviceId->getPciPath() + "/drm";
193184
std::string expectedFilePrefix = path + "/card";

shared/source/os_interface/linux/drm_neo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ class Drm : public DriverModel {
264264
void cleanup() override;
265265
bool readSysFsAsString(const std::string &relativeFilePath, std::string &readString);
266266
MOCKABLE_VIRTUAL std::string getSysFsPciPath();
267-
MOCKABLE_VIRTUAL std::string getSysFsPciPathBaseName();
268267
std::unique_ptr<HwDeviceIdDrm> &getHwDeviceId() { return hwDeviceId; }
269268

270269
template <typename DataType>

shared/test/unit_test/device/neo_device_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,7 +1983,7 @@ TEST_F(DeviceTests, GivenDebuggingEnabledWhenDeviceIsInitializedThenL0DebuggerIs
19831983
EXPECT_NE(nullptr, device->getL0Debugger());
19841984
}
19851985

1986-
TEST_F(DeviceTests, givenDebuggerRequestedByUserAndNotAvailableWhenDeviceIsInitializedThenDeviceIsNullAndErrorIsPrinted) {
1986+
TEST_F(DeviceTests, givenDebuggerRequestedByUserAndNotAvailableWhenDeviceIsInitializedThenErrorIsPrintedButNotReturned) {
19871987
extern bool forceCreateNullptrDebugger;
19881988

19891989
VariableBackup backupForceCreateNullptrDebugger{&forceCreateNullptrDebugger, true};
@@ -1998,7 +1998,7 @@ TEST_F(DeviceTests, givenDebuggerRequestedByUserAndNotAvailableWhenDeviceIsIniti
19981998
auto output = testing::internal::GetCapturedStderr();
19991999

20002000
EXPECT_EQ(std::string("Debug mode is not enabled in the system.\n"), output);
2001-
EXPECT_EQ(nullptr, device);
2001+
EXPECT_EQ(nullptr, device->getL0Debugger());
20022002
}
20032003

20042004
TEST_F(DeviceTests, givenDebuggerRequestedByUserWhenDeviceWithSubDevicesCreatedThenInitializeDebuggerOncePerRootDevice) {

shared/test/unit_test/os_interface/linux/drm_tests.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,20 +2267,3 @@ TEST(DrmTest, GivenProductSpecificIoctlHelperAvailableAndDebugFlagToIgnoreIsSetW
22672267

22682268
EXPECT_EQ(0u, customFuncCalled);
22692269
}
2270-
2271-
TEST(DrmTest, GivenSysFsPciPathWhenCallinggetSysFsPciPathBaseNameThenResultIsCorrect) {
2272-
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
2273-
2274-
class DrmMockPciPath : public DrmMock {
2275-
public:
2276-
DrmMockPciPath(RootDeviceEnvironment &rootDeviceEnvironment) : DrmMock(rootDeviceEnvironment) {}
2277-
std::string mockSysFsPciPath = "/sys/devices/pci0000:00/0000:00:02.0/drm/card0";
2278-
std::string getSysFsPciPath() override { return mockSysFsPciPath; }
2279-
};
2280-
DrmMockPciPath drm{*executionEnvironment->rootDeviceEnvironments[0]};
2281-
EXPECT_STREQ("card0", drm.getSysFsPciPathBaseName().c_str());
2282-
drm.mockSysFsPciPath = "/sys/devices/pci0000:00/0000:00:02.0/drm/card7";
2283-
EXPECT_STREQ("card7", drm.getSysFsPciPathBaseName().c_str());
2284-
drm.mockSysFsPciPath = "card8";
2285-
EXPECT_STREQ("card8", drm.getSysFsPciPathBaseName().c_str());
2286-
}

0 commit comments

Comments
 (0)