From 0d07b3477b3fe7db992f620011743eaa3c782ae5 Mon Sep 17 00:00:00 2001 From: Divya Shikre Date: Wed, 6 Apr 2022 16:32:23 -0400 Subject: [PATCH] kfdtest: Add log message in KFDEvictTest Map failures happen in AllocBuffers function when there isn't enough space to move BO to vram. In such cases, the function retries allocation/map until successful to continue testing eviction and restore. Print a message in KFDEvictTest when this happens to correlate to the message seen in the kernel log. amdgpu 0000:c1:00.0: amdgpu: Failed to map peer:0000:c1:00.0 mem_domain:4 Signed-off-by: Divya Shikre Change-Id: I0475d8d9521a07612182e54fc7cddb9bd44353e6 --- tests/kfdtest/src/KFDEvictTest.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/kfdtest/src/KFDEvictTest.cpp b/tests/kfdtest/src/KFDEvictTest.cpp index a9544eb47c..7ec86bc8bd 100644 --- a/tests/kfdtest/src/KFDEvictTest.cpp +++ b/tests/kfdtest/src/KFDEvictTest.cpp @@ -84,21 +84,23 @@ void KFDEvictTest::AllocBuffers(HSAuint32 defaultGPUNode, HSAuint32 count, HSAui if (hsaKmtMapMemoryToGPUNodes(m_pBuf, vramBufSize, NULL, mapFlags, 1, reinterpret_cast(&defaultGPUNode)) == HSAKMT_STATUS_ERROR) { EXPECT_SUCCESS(hsaKmtFreeMemory(m_pBuf, vramBufSize)); - break; + LOG() << "Map failed for " << i << "/" << count << " buffer. Retrying allocation" << std::endl; + goto retry; } } pBuffers.push_back(m_pBuf); i++; retry = 0; - } else { - if (retry++ > ALLOCATE_RETRY_TIMES) { - break; - } - - /* Wait for 1 second to try allocate again */ - sleep(1); + continue; } +retry: + if (retry++ > ALLOCATE_RETRY_TIMES) { + break; + } + + /* Wait for 1 second to try allocate again */ + sleep(1); } }