fix: Fix debugger module load before eventsToAck updated

This fixes an uncommon race condition in processing vmBinds in debugger
where occasionally a VMBind may go unacked.

Related-to: NEO-12866

Signed-off-by: Brandon Yates <brandon.yates@intel.com>
This commit is contained in:
Brandon Yates
2024-10-02 20:40:05 +00:00
committed by Compute-Runtime-Automation
parent 43cf7abf65
commit be295ef9a0
4 changed files with 20 additions and 2 deletions

View File

@@ -225,6 +225,21 @@ struct MockDebugSessionLinuxXe : public L0::DebugSessionLinuxXe {
return DebugSessionLinuxXe::getInternalEvent();
}
bool pushApiEventValidateAckEvents = false;
bool pushApiEventAckEventsFound = false;
void pushApiEvent(zet_debug_event_t &debugEvent, uint64_t moduleHandle) override {
if (pushApiEventValidateAckEvents) {
auto connection = clientHandleToConnection[clientHandle].get();
for (auto module : connection->metaDataToModule) {
if (module.second.ackEvents[0].size() > 0) {
pushApiEventAckEventsFound = true;
break;
}
}
}
return DebugSessionLinux::pushApiEvent(debugEvent, moduleHandle);
}
bool readSystemRoutineIdentFromMemory(EuThread *thread, const void *stateSaveArea, SIP::sr_ident &srIdent) override {
readSystemRoutineIdentFromMemoryCallCount++;
srIdent.count = 0;

View File

@@ -1310,6 +1310,7 @@ TEST_F(DebugApiLinuxTestXe, GivenVmBindOpMetadataCreateEventAndUfenceForProgramM
client1.base.type = DRM_XE_EUDEBUG_EVENT_OPEN;
client1.base.flags = DRM_XE_EUDEBUG_EVENT_CREATE;
client1.client_handle = MockDebugSessionLinuxXe::mockClientHandle;
session->pushApiEventValidateAckEvents = true;
session->handleEvent(reinterpret_cast<drm_xe_eudebug_event *>(&client1));
auto &connection = session->clientHandleToConnection[MockDebugSessionLinuxXe::mockClientHandle];
@@ -1381,6 +1382,8 @@ TEST_F(DebugApiLinuxTestXe, GivenVmBindOpMetadataCreateEventAndUfenceForProgramM
EXPECT_EQ(vmBindOpData.pendingNumExtensions, 0ull);
EXPECT_EQ(vmBindOpData.vmBindOpMetadataVec.size(), 2ull);
EXPECT_TRUE(session->pushApiEventAckEventsFound);
EXPECT_EQ(connection->metaDataToModule[10].ackEvents->size(), 1ull);
EXPECT_EQ(connection->metaDataToModule[10].ackEvents[0][0].seqno, vmBindUfence.base.seqno);
EXPECT_EQ(connection->metaDataToModule[10].ackEvents[0][0].type, vmBindUfence.base.type);