mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 00:24:58 +08:00
fix: Add missing methods in asyncThreadFunction
Add generateEventsAndResumeStoppedThreads() and sendInterrupts() in asyncThreadFunction(). Related-To: NEO-11014 Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
6ce8642625
commit
27c3a4753d
@@ -102,6 +102,8 @@ void *DebugSessionLinuxXe::asyncThreadFunction(void *arg) {
|
|||||||
|
|
||||||
while (self->asyncThread.threadActive) {
|
while (self->asyncThread.threadActive) {
|
||||||
self->handleEventsAsync();
|
self->handleEventsAsync();
|
||||||
|
self->generateEventsAndResumeStoppedThreads();
|
||||||
|
self->sendInterrupts();
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_DEBUGGER_INFO_LOG("Debugger async thread closing\n", "");
|
PRINT_DEBUGGER_INFO_LOG("Debugger async thread closing\n", "");
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ struct MockDebugSessionLinuxXe : public L0::DebugSessionLinuxXe {
|
|||||||
static constexpr uint64_t mockClientHandle = 1;
|
static constexpr uint64_t mockClientHandle = 1;
|
||||||
std::unordered_map<uint64_t, uint8_t> stoppedThreads;
|
std::unordered_map<uint64_t, uint8_t> stoppedThreads;
|
||||||
uint32_t countToAddThreadToNewlyStoppedFromRaisedAttentionForTileSession = 0;
|
uint32_t countToAddThreadToNewlyStoppedFromRaisedAttentionForTileSession = 0;
|
||||||
|
int64_t returnTimeDiff = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MockAsyncThreadDebugSessionLinuxXe : public MockDebugSessionLinuxXe {
|
struct MockAsyncThreadDebugSessionLinuxXe : public MockDebugSessionLinuxXe {
|
||||||
|
|||||||
@@ -1982,5 +1982,41 @@ TEST_F(DebugApiLinuxTestXe, GivenNoElfDataImplementationThenGetElfDataReturnsNul
|
|||||||
ASSERT_EQ(clientConnection->metaDataMap[11].metadata.len, sessionMock->getClientConnection(MockDebugSessionLinuxXe::mockClientHandle)->getElfSize(11));
|
ASSERT_EQ(clientConnection->metaDataMap[11].metadata.len, sessionMock->getClientConnection(MockDebugSessionLinuxXe::mockClientHandle)->getElfSize(11));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DebugApiLinuxTestXe, GivenInterruptedThreadsWhenNoAttentionEventIsReadThenThreadUnavailableEventIsGenerated) {
|
||||||
|
zet_debug_config_t config = {};
|
||||||
|
config.pid = 0x1234;
|
||||||
|
|
||||||
|
auto session = std::make_unique<MockDebugSessionLinuxXe>(config, device, 10);
|
||||||
|
ASSERT_NE(nullptr, session);
|
||||||
|
|
||||||
|
session->clientHandle = MockDebugSessionLinuxXe::mockClientHandle;
|
||||||
|
|
||||||
|
auto handler = new MockIoctlHandlerXe;
|
||||||
|
session->ioctlHandler.reset(handler);
|
||||||
|
session->returnTimeDiff = DebugSessionLinuxXe::interruptTimeout * 10;
|
||||||
|
session->synchronousInternalEventRead = true;
|
||||||
|
|
||||||
|
ze_device_thread_t thread = {0, 0, 0, UINT32_MAX};
|
||||||
|
|
||||||
|
auto result = session->interrupt(thread);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
session->startAsyncThread();
|
||||||
|
|
||||||
|
while (session->getInternalEventCounter < 2)
|
||||||
|
;
|
||||||
|
|
||||||
|
session->closeAsyncThread();
|
||||||
|
|
||||||
|
EXPECT_EQ(session->apiEvents.size(), 1u);
|
||||||
|
if (session->apiEvents.size() > 0) {
|
||||||
|
auto event = session->apiEvents.front();
|
||||||
|
EXPECT_EQ(ZET_DEBUG_EVENT_TYPE_THREAD_UNAVAILABLE, event.type);
|
||||||
|
EXPECT_EQ(0u, event.info.thread.thread.slice);
|
||||||
|
EXPECT_EQ(0u, event.info.thread.thread.subslice);
|
||||||
|
EXPECT_EQ(0u, event.info.thread.thread.eu);
|
||||||
|
EXPECT_EQ(UINT32_MAX, event.info.thread.thread.thread);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ult
|
} // namespace ult
|
||||||
} // namespace L0
|
} // namespace L0
|
||||||
Reference in New Issue
Block a user