diff --git a/level_zero/tools/source/debug/debug_session_imp.cpp b/level_zero/tools/source/debug/debug_session_imp.cpp index c5630bbce4..6065489267 100644 --- a/level_zero/tools/source/debug/debug_session_imp.cpp +++ b/level_zero/tools/source/debug/debug_session_imp.cpp @@ -1739,7 +1739,11 @@ ze_result_t DebugSessionImp::readFifo(uint64_t vmHandle, std::vectorregHeaderV3.fifo_head; + retVal = readGpuMemory(vmHandle, reinterpret_cast(&lastHead), sizeof(uint32_t), gpuVa + offsetHead); + if (retVal != ZE_RESULT_SUCCESS) { + PRINT_DEBUGGER_ERROR_LOG("Reading fifo_head failed, error = %d\n", retVal); + return retVal; + } NEO::sleep(std::chrono::milliseconds(failsafeTimeoutWait)); } return ZE_RESULT_SUCCESS; diff --git a/level_zero/tools/test/unit_tests/sources/debug/debug_session_tests.cpp b/level_zero/tools/test/unit_tests/sources/debug/debug_session_tests.cpp index b9698f5d65..efff5c1bce 100644 --- a/level_zero/tools/test/unit_tests/sources/debug/debug_session_tests.cpp +++ b/level_zero/tools/test/unit_tests/sources/debug/debug_session_tests.cpp @@ -1942,6 +1942,14 @@ TEST_F(DebugSessionTestSwFifoFixture, GivenSwFifoWhenReadGpuMemoryFailsDuringFif EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, session->readFifo(0, threadsWithAttention)); } +TEST_F(DebugSessionTestSwFifoFixture, GivenSwFifoWhenReadGpuMemoryFailsDuringUpdateOfLastHeadThenErrorReturned) { + + EXPECT_FALSE(session->stateSaveAreaHeader.empty()); + session->forcereadGpuMemoryFailOnCount = 4; + std::vector threadsWithAttention; + EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, session->readFifo(0, threadsWithAttention)); +} + TEST(DebugSessionTest, GivenSwFifoWhenStateSaveAreaVersionIsLessThanThreeDuringFifoReadThenFifoIsNotReadAndSuccessIsReturned) { auto stateSaveAreaHeader = MockSipData::createStateSaveAreaHeader(2);