diff --git a/level_zero/core/source/cmdqueue/cmdqueue.cpp b/level_zero/core/source/cmdqueue/cmdqueue.cpp index 284e6739a2..77909d4792 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue.cpp +++ b/level_zero/core/source/cmdqueue/cmdqueue.cpp @@ -63,7 +63,7 @@ ze_result_t CommandQueueImp::initialize(bool copyOnly, bool isInternal) { partitionCount = csr->getActivePartitions(); } if (NEO::Debugger::isDebugEnabled(internalUsage) && device->getL0Debugger()) { - device->getL0Debugger()->notifyCommandQueueCreated(device->getNEODevice()); + device->getL0Debugger()->notifyCommandQueueCreated(); } } return returnValue; diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl index f98661ca4f..b6957c0729 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl @@ -61,7 +61,7 @@ ze_result_t CommandQueueHw::destroy() { } buffers.destroy(this->getDevice()); if (NEO::Debugger::isDebugEnabled(internalUsage) && device->getL0Debugger()) { - device->getL0Debugger()->notifyCommandQueueDestroyed(device->getNEODevice()); + device->getL0Debugger()->notifyCommandQueueDestroyed(); } delete this; return ZE_RESULT_SUCCESS; diff --git a/level_zero/core/test/unit_tests/sources/debugger/linux/test_l0_debugger_linux.cpp b/level_zero/core/test/unit_tests/sources/debugger/linux/test_l0_debugger_linux.cpp index 7c0b13bfd8..81fafea510 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/linux/test_l0_debugger_linux.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/linux/test_l0_debugger_linux.cpp @@ -14,7 +14,6 @@ #include "level_zero/core/source/cmdlist/cmdlist.h" #include "level_zero/core/source/device/device.h" -#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" #include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h" #include "level_zero/core/test/unit_tests/sources/debugger/l0_debugger_fixture.h" @@ -27,13 +26,13 @@ namespace L0 { namespace ult { struct L0DebuggerLinuxFixture { - void SetUp(HardwareInfo *hwInfo = nullptr) { + void SetUp() { // NOLINT(readability-identifier-naming) auto executionEnvironment = new NEO::ExecutionEnvironment(); - auto mockBuiltIns = new NEO::MockBuiltins(); + auto mockBuiltIns = new MockBuiltins(); executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->setDebuggingEnabled(); executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(mockBuiltIns); - executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(hwInfo ? hwInfo : defaultHwInfo.get()); + executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get()); executionEnvironment->initializeMemoryManager(); auto osInterface = new OSInterface(); drmMock = new DrmMockResources(*executionEnvironment->rootDeviceEnvironments[0]); @@ -51,7 +50,8 @@ struct L0DebuggerLinuxFixture { device = driverHandle->devices[0]; } - void TearDown(){}; + void TearDown() { // NOLINT(readability-identifier-naming) + } std::unique_ptr> driverHandle; NEO::MockDevice *neoDevice = nullptr; @@ -59,39 +59,7 @@ struct L0DebuggerLinuxFixture { DrmMockResources *drmMock = nullptr; }; -struct L0DebuggerLinuxMultitileFixture : public L0DebuggerLinuxFixture { - - void SetUp() { - - DebugManager.flags.CreateMultipleRootDevices.set(1); - constexpr auto numSubDevices = 2u; - DebugManager.flags.CreateMultipleSubDevices.set(2); - hwInfo = *defaultHwInfo; - - hwInfo.gtSystemInfo.MultiTileArchInfo.IsValid = 1; - hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = numSubDevices; - hwInfo.gtSystemInfo.MultiTileArchInfo.Tile0 = 1; - hwInfo.gtSystemInfo.MultiTileArchInfo.Tile1 = 1; - hwInfo.gtSystemInfo.MultiTileArchInfo.TileMask = 3; - - L0DebuggerLinuxFixture::SetUp(&hwInfo); - - subDevice0 = neoDevice->getSubDevice(0)->getSpecializedDevice(); - subDevice1 = neoDevice->getSubDevice(1)->getSpecializedDevice(); - } - - void TearDown() { - L0DebuggerLinuxFixture::TearDown(); - } - - DebugManagerStateRestore restorer; - HardwareInfo hwInfo; - L0::Device *subDevice0 = nullptr; - L0::Device *subDevice1 = nullptr; -}; - using L0DebuggerLinuxTest = Test; -using L0DebuggerLinuxMultitileTest = Test; TEST_F(L0DebuggerLinuxTest, givenProgramDebuggingEnabledWhenDriverHandleIsCreatedThenItAllocatesL0Debugger) { EXPECT_NE(nullptr, neoDevice->getDebugger()); @@ -324,40 +292,5 @@ HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledWhenImmCommandListsCreatedAnd EXPECT_EQ(2u, debuggerL0Hw->commandQueueDestroyedCount); } -HWTEST_F(L0DebuggerLinuxMultitileTest, givenDebuggingEnabledWhenCommandQueuesCreatedThenDebuggerIsNotified) { - - auto debuggerL0Hw = static_cast *>(device->getL0Debugger()); - drmMock->ioctlCallsCount = 0; - neoDevice->getDefaultEngine().commandStreamReceiver->getOsContext().ensureContextInitialized(); - - EXPECT_EQ(2u, debuggerL0Hw->uuidL0CommandQueueHandle.size()); - - ze_command_queue_desc_t queueDesc = {}; - ze_result_t returnValue; - - auto commandQueue1 = CommandQueue::create(productFamily, subDevice0, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, false, false, returnValue); - EXPECT_EQ(1u, drmMock->ioctlCallsCount); - EXPECT_EQ(1u, debuggerL0Hw->commandQueueCreatedCount); - EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); - - auto commandQueue2 = CommandQueue::create(productFamily, subDevice1, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, false, false, returnValue); - EXPECT_EQ(2u, debuggerL0Hw->commandQueueCreatedCount); - EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); - - for (uint32_t index = 0; index < neoDevice->getNumSubDevices(); index++) { - EXPECT_NE(0u, debuggerL0Hw->uuidL0CommandQueueHandle[index]); - } - - commandQueue1->destroy(); - EXPECT_EQ(1u, debuggerL0Hw->commandQueueDestroyedCount); - - commandQueue2->destroy(); - EXPECT_EQ(2u, drmMock->unregisterCalledCount); - EXPECT_EQ(2u, debuggerL0Hw->commandQueueDestroyedCount); - - for (uint32_t index = 0; index < neoDevice->getNumSubDevices(); index++) { - EXPECT_EQ(0u, debuggerL0Hw->uuidL0CommandQueueHandle[index]); - } -} } // namespace ult } // namespace L0 diff --git a/level_zero/tools/source/debug/linux/prelim/debug_session.cpp b/level_zero/tools/source/debug/linux/prelim/debug_session.cpp index 1569133416..0f4a345fea 100644 --- a/level_zero/tools/source/debug/linux/prelim/debug_session.cpp +++ b/level_zero/tools/source/debug/linux/prelim/debug_session.cpp @@ -459,20 +459,10 @@ void DebugSessionLinux::handleEvent(prelim_drm_i915_debug_event *event) { clientHandleToConnection[uuid->client_handle]->uuidToModule.erase(uuid->handle); } - if (destroy && (clientHandle == uuid->client_handle)) { - - for (const auto &uuidToDevice : uuidL0CommandQueueHandleToDevice) { - if (uuidToDevice.first == uuid->handle) { - uuidL0CommandQueueHandleToDevice.erase(uuidToDevice.first); - - if (uuidL0CommandQueueHandleToDevice.size() == 0) { - zet_debug_event_t debugEvent = {}; - debugEvent.type = ZET_DEBUG_EVENT_TYPE_PROCESS_EXIT; - pushApiEvent(debugEvent, nullptr); - } - break; - } - } + if (destroy && (uuidL0CommandQueueHandle == uuid->handle) && (clientHandle == uuid->client_handle)) { + zet_debug_event_t debugEvent = {}; + debugEvent.type = ZET_DEBUG_EVENT_TYPE_PROCESS_EXIT; + pushApiEvent(debugEvent, nullptr); break; } @@ -495,20 +485,10 @@ void DebugSessionLinux::handleEvent(prelim_drm_i915_debug_event *event) { if (uuidString == NEO::uuidL0CommandQueueHash) { if ((clientHandle == invalidClientHandle) || (clientHandle == uuid->client_handle)) { clientHandle = uuid->client_handle; - - uint32_t deviceIndex = 0; - if (readUuid.payload_size == sizeof(NEO::DebuggerL0::CommandQueueNotification)) { - auto notification = reinterpret_cast(payload.get()); - deviceIndex = notification->subDeviceIndex; - UNRECOVERABLE_IF(notification->subDeviceIndex >= notification->subDeviceCount); - } - - if (uuidL0CommandQueueHandleToDevice.size() == 0) { - zet_debug_event_t debugEvent = {}; - debugEvent.type = ZET_DEBUG_EVENT_TYPE_PROCESS_ENTRY; - pushApiEvent(debugEvent, nullptr); - } - uuidL0CommandQueueHandleToDevice[uuid->handle] = deviceIndex; + uuidL0CommandQueueHandle = uuid->handle; + zet_debug_event_t debugEvent = {}; + debugEvent.type = ZET_DEBUG_EVENT_TYPE_PROCESS_ENTRY; + pushApiEvent(debugEvent, nullptr); } } diff --git a/level_zero/tools/source/debug/linux/prelim/debug_session.h b/level_zero/tools/source/debug/linux/prelim/debug_session.h index 3063d25fdb..b06ec835c6 100644 --- a/level_zero/tools/source/debug/linux/prelim/debug_session.h +++ b/level_zero/tools/source/debug/linux/prelim/debug_session.h @@ -248,7 +248,7 @@ struct DebugSessionLinux : DebugSessionImp { uint64_t clientHandle = invalidClientHandle; uint64_t clientHandleClosed = invalidClientHandle; - std::unordered_map uuidL0CommandQueueHandleToDevice; + uint64_t uuidL0CommandQueueHandle = invalidClientHandle; uint64_t euControlInterruptSeqno[NEO::EngineLimits::maxHandleCount]; std::unordered_map> clientHandleToConnection; diff --git a/level_zero/tools/test/unit_tests/sources/debug/linux/test_debug_api_linux.cpp b/level_zero/tools/test/unit_tests/sources/debug/linux/test_debug_api_linux.cpp index 22e0453f04..2ee358ee66 100644 --- a/level_zero/tools/test/unit_tests/sources/debug/linux/test_debug_api_linux.cpp +++ b/level_zero/tools/test/unit_tests/sources/debug/linux/test_debug_api_linux.cpp @@ -296,7 +296,7 @@ struct MockDebugSessionLinux : public L0::DebugSessionLinux { using L0::DebugSessionLinux::ThreadControlCmd; using L0::DebugSessionLinux::typeToRegsetDesc; using L0::DebugSessionLinux::typeToRegsetFlags; - using L0::DebugSessionLinux::uuidL0CommandQueueHandleToDevice; + using L0::DebugSessionLinux::uuidL0CommandQueueHandle; using L0::DebugSessionLinux::writeGpuMemory; MockDebugSessionLinux(const zet_debug_config_t &config, L0::Device *device, int debugFd) : DebugSessionLinux(config, device, debugFd) { @@ -1152,9 +1152,6 @@ TEST_F(DebugApiLinuxTest, GivenUuidCommandQueueCreatedHandledThenProcessEntryEve EXPECT_EQ(1u, session->apiEvents.size()); EXPECT_EQ(MockDebugSessionLinux::mockClientHandle, session->clientHandle); EXPECT_EQ(3, handler->ioctlCalled); - - EXPECT_EQ(0u, session->uuidL0CommandQueueHandleToDevice[2]); - auto event = session->apiEvents.front(); EXPECT_EQ(ZET_DEBUG_EVENT_TYPE_PROCESS_ENTRY, event.type); @@ -1162,86 +1159,11 @@ TEST_F(DebugApiLinuxTest, GivenUuidCommandQueueCreatedHandledThenProcessEntryEve uuid.client_handle = MockDebugSessionLinux::mockClientHandle; handler->returnUuid = &readUuid; session->handleEvent(&uuid.base); - EXPECT_EQ(1u, session->apiEvents.size()); + EXPECT_EQ(2u, session->apiEvents.size()); EXPECT_EQ(MockDebugSessionLinux::mockClientHandle, session->clientHandle); EXPECT_EQ(4, handler->ioctlCalled); -} - -TEST_F(DebugApiLinuxTest, GivenUuidCommandQueueWhenQueuesOnToSubdevicesCreatedAndDestroyedThenProcessEntryAndExitEventIsGeneratedOnce) { - zet_debug_config_t config = {}; - config.pid = 0x1234; - - auto session = std::make_unique(config, device, 10); - ASSERT_NE(nullptr, session); - session->clientHandle = MockDebugSessionLinux::mockClientHandle; - - prelim_drm_i915_debug_event_uuid uuid = {}; - uuid.base.type = PRELIM_DRM_I915_DEBUG_EVENT_UUID; - uuid.base.flags = PRELIM_DRM_I915_DEBUG_EVENT_CREATE; - uuid.base.size = sizeof(prelim_drm_i915_debug_event_uuid); - uuid.client_handle = MockDebugSessionLinux::mockClientHandle; - uuid.handle = 2; - uuid.payload_size = sizeof(NEO::DebuggerL0::CommandQueueNotification); - - auto uuidHash = NEO::uuidL0CommandQueueHash; - prelim_drm_i915_debug_read_uuid readUuid = {}; - memcpy(readUuid.uuid, uuidHash, strlen(uuidHash)); - - NEO::DebuggerL0::CommandQueueNotification notification; - notification.subDeviceCount = 2; - notification.subDeviceIndex = 1; - readUuid.payload_ptr = reinterpret_cast(¬ification); - readUuid.payload_size = sizeof(NEO::DebuggerL0::CommandQueueNotification); - readUuid.handle = uuid.handle; - - auto handler = new MockIoctlHandler; - session->ioctlHandler.reset(handler); - handler->returnUuid = &readUuid; - - // Handle UUID create for commandQueue on subdevice 1 - session->handleEvent(&uuid.base); - EXPECT_EQ(1, handler->ioctlCalled); - EXPECT_EQ(1u, session->apiEvents.size()); - auto event = session->apiEvents.front(); - EXPECT_EQ(ZET_DEBUG_EVENT_TYPE_PROCESS_ENTRY, event.type); - - EXPECT_EQ(1u, session->uuidL0CommandQueueHandleToDevice.size()); - - notification.subDeviceCount = 2; - notification.subDeviceIndex = 0; - uuid.handle = 3; - handler->returnUuid = &readUuid; - - // Handle UUID create for commandQueue on subdevice 0 - session->handleEvent(&uuid.base); - EXPECT_EQ(2, handler->ioctlCalled); - EXPECT_EQ(1u, session->apiEvents.size()); - - EXPECT_EQ(2u, session->uuidL0CommandQueueHandleToDevice.size()); - EXPECT_EQ(1u, session->uuidL0CommandQueueHandleToDevice[2]); - EXPECT_EQ(0u, session->uuidL0CommandQueueHandleToDevice[3]); - - // Handle UUID destroy for commandQueue on subdevice 0 - uuid.base.flags = PRELIM_DRM_I915_DEBUG_EVENT_DESTROY; - session->handleEvent(&uuid.base); - - EXPECT_EQ(1u, session->uuidL0CommandQueueHandleToDevice.size()); - EXPECT_EQ(1u, session->apiEvents.size()); - - // Handle UUID destroy with invalid uuid handle - uuid.handle = 300; - session->handleEvent(&uuid.base); - EXPECT_EQ(1u, session->uuidL0CommandQueueHandleToDevice.size()); - - // Handle UUID destroy for commandQueue on subdevice 1 - uuid.handle = 2; - session->handleEvent(&uuid.base); - EXPECT_EQ(0u, session->uuidL0CommandQueueHandleToDevice.size()); - EXPECT_EQ(2u, session->apiEvents.size()); - - session->apiEvents.pop(); event = session->apiEvents.front(); - EXPECT_EQ(ZET_DEBUG_EVENT_TYPE_PROCESS_EXIT, event.type); + EXPECT_EQ(ZET_DEBUG_EVENT_TYPE_PROCESS_ENTRY, event.type); } TEST_F(DebugApiLinuxTest, GivenCommandQueueDestroyedWhenHandlingEventThenExitEventIsGenerated) { @@ -1251,8 +1173,7 @@ TEST_F(DebugApiLinuxTest, GivenCommandQueueDestroyedWhenHandlingEventThenExitEve auto session = std::make_unique(config, device, 10); ASSERT_NE(nullptr, session); session->clientHandle = DebugSessionLinux::invalidHandle; - const uint64_t validUuidCmdQHandle = 5u; - session->uuidL0CommandQueueHandleToDevice[validUuidCmdQHandle] = 0; + session->uuidL0CommandQueueHandle = 5; prelim_drm_i915_debug_event_uuid uuid = {}; uuid.base.type = PRELIM_DRM_I915_DEBUG_EVENT_UUID; @@ -1272,7 +1193,7 @@ TEST_F(DebugApiLinuxTest, GivenCommandQueueDestroyedWhenHandlingEventThenExitEve session->handleEvent(&uuid.base); EXPECT_EQ(0u, session->apiEvents.size()); - uuid.handle = validUuidCmdQHandle; + uuid.handle = session->uuidL0CommandQueueHandle; session->handleEvent(&uuid.base); EXPECT_EQ(0u, session->apiEvents.size()); diff --git a/shared/source/debugger/debugger_l0.cpp b/shared/source/debugger/debugger_l0.cpp index 96d04facee..784af5d064 100644 --- a/shared/source/debugger/debugger_l0.cpp +++ b/shared/source/debugger/debugger_l0.cpp @@ -25,14 +25,6 @@ DebugerL0CreateFn debuggerL0Factory[IGFX_MAX_CORE] = {}; DebuggerL0::DebuggerL0(NEO::Device *device) : device(device) { isLegacyMode = false; - const auto deviceCount = std::max(1u, device->getNumSubDevices()); - commandQueueCount.resize(deviceCount); - uuidL0CommandQueueHandle.resize(deviceCount); - - for (uint32_t i = 0; i < deviceCount; i++) { - commandQueueCount[i] = 0; - uuidL0CommandQueueHandle[i] = 0; - } initialize(); } diff --git a/shared/source/debugger/debugger_l0.h b/shared/source/debugger/debugger_l0.h index 3e0b659358..f2afc9c93e 100644 --- a/shared/source/debugger/debugger_l0.h +++ b/shared/source/debugger/debugger_l0.h @@ -12,7 +12,6 @@ #include #include -#include #include namespace NEO { @@ -92,8 +91,8 @@ class DebuggerL0 : public NEO::Debugger, NEO::NonCopyableOrMovableClass { void captureStateBaseAddress(NEO::LinearStream &cmdStream, SbaAddresses sba) override; void printTrackedAddresses(uint32_t contextId); MOCKABLE_VIRTUAL void registerElf(NEO::DebugData *debugData, NEO::GraphicsAllocation *isaAllocation); - MOCKABLE_VIRTUAL void notifyCommandQueueCreated(NEO::Device *device); - MOCKABLE_VIRTUAL void notifyCommandQueueDestroyed(NEO::Device *device); + MOCKABLE_VIRTUAL void notifyCommandQueueCreated(); + MOCKABLE_VIRTUAL void notifyCommandQueueDestroyed(); MOCKABLE_VIRTUAL void notifyModuleLoadAllocations(const StackVec &allocs); MOCKABLE_VIRTUAL void notifyModuleCreate(void *module, uint32_t moduleSize, uint64_t moduleLoadAddress); MOCKABLE_VIRTUAL void registerAllocationType(GraphicsAllocation *allocation); @@ -111,11 +110,6 @@ class DebuggerL0 : public NEO::Debugger, NEO::NonCopyableOrMovableClass { } bool getSingleAddressSpaceSbaTracking() { return singleAddressSpaceSbaTracking; } - struct CommandQueueNotification { - uint32_t subDeviceIndex = 0; - uint32_t subDeviceCount = 0; - }; - protected: static bool isAnyTrackedAddressChanged(SbaAddresses sba) { return sba.GeneralStateBaseAddress != 0 || @@ -131,14 +125,12 @@ class DebuggerL0 : public NEO::Debugger, NEO::NonCopyableOrMovableClass { std::unordered_map perContextSbaAllocations; NEO::AddressRange sbaTrackingGpuVa{}; NEO::GraphicsAllocation *moduleDebugArea = nullptr; - std::vector commandQueueCount; - std::vector uuidL0CommandQueueHandle; + std::atomic commandQueueCount = 0u; + uint32_t uuidL0CommandQueueHandle = 0; bool singleAddressSpaceSbaTracking = false; std::mutex debuggerL0Mutex; }; -static_assert(std::is_standard_layout::value, "DebuggerL0::CommandQueueNotification issue"); - using DebugerL0CreateFn = DebuggerL0 *(*)(NEO::Device *device); extern DebugerL0CreateFn debuggerL0Factory[]; diff --git a/shared/source/debugger/linux/debugger_l0_linux.cpp b/shared/source/debugger/linux/debugger_l0_linux.cpp index d357fe9a75..e7b5bb9ce7 100644 --- a/shared/source/debugger/linux/debugger_l0_linux.cpp +++ b/shared/source/debugger/linux/debugger_l0_linux.cpp @@ -64,31 +64,20 @@ bool DebuggerL0::removeZebinModule(uint32_t moduleHandle) { return true; } -void DebuggerL0::notifyCommandQueueCreated(NEO::Device *device) { - if (this->device->getRootDeviceEnvironment().osInterface.get() != nullptr) { - std::unique_lock commandQueueCountLock(debuggerL0Mutex); - - auto index = device->isSubDevice() ? static_cast(device)->getSubDeviceIndex() : 0; - - if (++commandQueueCount[index] == 1) { - auto drm = this->device->getRootDeviceEnvironment().osInterface->getDriverModel()->as(); - - CommandQueueNotification notification = {index, this->device->getNumSubDevices()}; - uuidL0CommandQueueHandle[index] = drm->notifyFirstCommandQueueCreated(¬ification, sizeof(CommandQueueNotification)); +void DebuggerL0::notifyCommandQueueCreated() { + if (device->getRootDeviceEnvironment().osInterface.get() != nullptr) { + if (++commandQueueCount == 1) { + auto drm = device->getRootDeviceEnvironment().osInterface->getDriverModel()->as(); + uuidL0CommandQueueHandle = drm->notifyFirstCommandQueueCreated(); } } } -void DebuggerL0::notifyCommandQueueDestroyed(NEO::Device *device) { - if (this->device->getRootDeviceEnvironment().osInterface.get() != nullptr) { - std::unique_lock commandQueueCountLock(debuggerL0Mutex); - - auto index = device->isSubDevice() ? static_cast(device)->getSubDeviceIndex() : 0; - - if (--commandQueueCount[index] == 0) { - auto drm = this->device->getRootDeviceEnvironment().osInterface->getDriverModel()->as(); - drm->notifyLastCommandQueueDestroyed(uuidL0CommandQueueHandle[index]); - uuidL0CommandQueueHandle[index] = 0; +void DebuggerL0::notifyCommandQueueDestroyed() { + if (device->getRootDeviceEnvironment().osInterface.get() != nullptr) { + if (--commandQueueCount == 0) { + auto drm = device->getRootDeviceEnvironment().osInterface->getDriverModel()->as(); + drm->notifyLastCommandQueueDestroyed(uuidL0CommandQueueHandle); } } } diff --git a/shared/source/debugger/windows/debugger_l0_windows.cpp b/shared/source/debugger/windows/debugger_l0_windows.cpp index eaa0a62d25..5fff11fd45 100644 --- a/shared/source/debugger/windows/debugger_l0_windows.cpp +++ b/shared/source/debugger/windows/debugger_l0_windows.cpp @@ -186,10 +186,10 @@ static NTSTATUS runEscape(NEO::Wddm *wddm, KM_ESCAPE_INFO &escapeInfo) { return wddm->escape(escapeCommand); } -void DebuggerL0::notifyCommandQueueCreated(NEO::Device *deviceIn) { +void DebuggerL0::notifyCommandQueueCreated() { if (device->getRootDeviceEnvironment().osInterface.get() != nullptr) { std::unique_lock commandQueueCountLock(debuggerL0Mutex); - if (++commandQueueCount[0] == 1) { + if (++commandQueueCount == 1) { auto pWddm = device->getRootDeviceEnvironment().osInterface->getDriverModel()->as(); int val = 0; KM_ESCAPE_INFO escapeInfo = {0}; @@ -202,10 +202,10 @@ void DebuggerL0::notifyCommandQueueCreated(NEO::Device *deviceIn) { } } -void DebuggerL0::notifyCommandQueueDestroyed(NEO::Device *deviceIn) { +void DebuggerL0::notifyCommandQueueDestroyed() { if (device->getRootDeviceEnvironment().osInterface.get() != nullptr) { std::unique_lock commandQueueCountLock(debuggerL0Mutex); - if (--commandQueueCount[0] == 0) { + if (--commandQueueCount == 0) { auto pWddm = device->getRootDeviceEnvironment().osInterface->getDriverModel()->as(); int val = 0; KM_ESCAPE_INFO escapeInfo = {0}; diff --git a/shared/source/os_interface/linux/drm_debug.cpp b/shared/source/os_interface/linux/drm_debug.cpp index 1e334a2878..65ded03f18 100644 --- a/shared/source/os_interface/linux/drm_debug.cpp +++ b/shared/source/os_interface/linux/drm_debug.cpp @@ -109,8 +109,8 @@ void Drm::setContextDebugFlag(uint32_t drmContextId) { DEBUG_BREAK_IF(retVal != 0 && contextDebugSupported); } -uint32_t Drm::notifyFirstCommandQueueCreated(const void *data, size_t size) { - const auto result = ioctlHelper->registerStringClassUuid(uuidL0CommandQueueHash, (uintptr_t)data, size); +uint32_t Drm::notifyFirstCommandQueueCreated() { + const auto result = ioctlHelper->registerStringClassUuid(uuidL0CommandQueueHash, (uintptr_t)uuidL0CommandQueueName, strnlen_s(uuidL0CommandQueueName, 100)); DEBUG_BREAK_IF(result.retVal); return result.handle; } diff --git a/shared/source/os_interface/linux/drm_neo.h b/shared/source/os_interface/linux/drm_neo.h index d67d9f1e5c..74e44c3f22 100644 --- a/shared/source/os_interface/linux/drm_neo.h +++ b/shared/source/os_interface/linux/drm_neo.h @@ -244,7 +244,7 @@ class Drm : public DriverModel { MOCKABLE_VIRTUAL bool completionFenceSupport(); - MOCKABLE_VIRTUAL uint32_t notifyFirstCommandQueueCreated(const void *data, size_t size); + MOCKABLE_VIRTUAL uint32_t notifyFirstCommandQueueCreated(); MOCKABLE_VIRTUAL void notifyLastCommandQueueDestroyed(uint32_t handle); uint64_t getPatIndex(Gmm *gmm, AllocationType allocationType, CacheRegion cacheRegion, CachePolicy cachePolicy, bool closEnabled) const; diff --git a/shared/test/common/libult/linux/drm_mock.h b/shared/test/common/libult/linux/drm_mock.h index b05f1808a6..11cfda6965 100644 --- a/shared/test/common/libult/linux/drm_mock.h +++ b/shared/test/common/libult/linux/drm_mock.h @@ -337,7 +337,7 @@ class DrmMockResources : public DrmMock { return bindAvailable; } - uint32_t notifyFirstCommandQueueCreated(const void *data, size_t size) override { + uint32_t notifyFirstCommandQueueCreated() override { ioctlCallsCount++; return 4; } diff --git a/shared/test/common/mocks/mock_l0_debugger.h b/shared/test/common/mocks/mock_l0_debugger.h index 4408cba867..3703e02b09 100644 --- a/shared/test/common/mocks/mock_l0_debugger.h +++ b/shared/test/common/mocks/mock_l0_debugger.h @@ -37,7 +37,6 @@ class MockDebuggerL0Hw : public NEO::DebuggerL0Hw { using NEO::DebuggerL0::perContextSbaAllocations; using NEO::DebuggerL0::sbaTrackingGpuVa; using NEO::DebuggerL0::singleAddressSpaceSbaTracking; - using NEO::DebuggerL0::uuidL0CommandQueueHandle; MockDebuggerL0Hw(NEO::Device *device) : NEO::DebuggerL0Hw(device) {} ~MockDebuggerL0Hw() override = default; @@ -81,14 +80,14 @@ class MockDebuggerL0Hw : public NEO::DebuggerL0Hw { return NEO::DebuggerL0Hw::removeZebinModule(moduleHandle); } - void notifyCommandQueueCreated(NEO::Device *device) override { + void notifyCommandQueueCreated() override { commandQueueCreatedCount++; - NEO::DebuggerL0Hw::notifyCommandQueueCreated(device); + NEO::DebuggerL0Hw::notifyCommandQueueCreated(); } - void notifyCommandQueueDestroyed(NEO::Device *device) override { + void notifyCommandQueueDestroyed() override { commandQueueDestroyedCount++; - NEO::DebuggerL0Hw::notifyCommandQueueDestroyed(device); + NEO::DebuggerL0Hw::notifyCommandQueueDestroyed(); } void registerAllocationType(NEO::GraphicsAllocation *allocation) override { diff --git a/shared/test/unit_test/os_interface/linux/drm_debug_prelim_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_debug_prelim_tests.cpp index 8ccc520eee..6b63e54dd3 100644 --- a/shared/test/unit_test/os_interface/linux/drm_debug_prelim_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_debug_prelim_tests.cpp @@ -143,7 +143,7 @@ TEST_F(DrmDebugPrelimTest, GivenDrmWhenNotifyFirstCommandQueueCreatedCalledThenC DrmQueryMock drm(*executionEnvironment->rootDeviceEnvironments[0]); auto handle = drm.context.uuidHandle; - auto registeredHandle = drm.notifyFirstCommandQueueCreated(nullptr, 0); + auto registeredHandle = drm.notifyFirstCommandQueueCreated(); EXPECT_EQ(handle + 1, drm.context.uuidHandle); EXPECT_EQ(handle, registeredHandle); @@ -151,7 +151,8 @@ TEST_F(DrmDebugPrelimTest, GivenDrmWhenNotifyFirstCommandQueueCreatedCalledThenC const auto &receivedUuid = drm.context.receivedRegisterUuid; ASSERT_TRUE(receivedUuid); EXPECT_EQ(DrmPrelimHelper::getStringUuidClass(), receivedUuid->uuidClass); - EXPECT_EQ(receivedUuid->size, 0u); + EXPECT_EQ(receivedUuid->size, strlen(uuidL0CommandQueueName)); + EXPECT_EQ(0, memcmp(reinterpret_cast(receivedUuid->ptr), uuidL0CommandQueueName, receivedUuid->size)); EXPECT_EQ(0, memcmp(receivedUuid->uuid, uuidL0CommandQueueHash, sizeof(receivedUuid->uuid))); } diff --git a/shared/test/unit_test/os_interface/linux/drm_debug_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_debug_tests.cpp index a33295272f..54812ee395 100644 --- a/shared/test/unit_test/os_interface/linux/drm_debug_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_debug_tests.cpp @@ -67,7 +67,7 @@ TEST_F(DrmDebugTest, whenNotifyCommandQueueCreateDestroyAreCalledThenImplementat DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]); drmMock.ioctlCallsCount = 0; - auto handle = drmMock.notifyFirstCommandQueueCreated(nullptr, 0); + auto handle = drmMock.notifyFirstCommandQueueCreated(); EXPECT_EQ(0u, handle); EXPECT_EQ(0u, drmMock.ioctlCallsCount);