kfdtest: increase BigBufStressTest timeout and avoid VM fault

If TTM eviction and restore happens, it may takes very long time if
retry, the longest time is 5 minutes during my test. There is chance
packet is submited to queue while eviction, we have to increase the
Wait4PacketConsumption timeout.

The queue will continue to execute after eviction and restore. If we
upmap the memory from GPU while queue is evicted, this will cause VM
fault. Change to unmap memory after queue is destroyed.



Change-Id: I1b44e2274ea7b83398b2e3293578dad6947cb5af
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
此提交包含在:
Philip Yang
2019-06-13 15:46:05 -04:00
父節點 36776e9917
當前提交 4066dcd542
+11 -7
查看文件
@@ -879,10 +879,11 @@ TEST_F(KFDMemoryTest, BigBufferStressTest) {
HSAuint64 block_size_mb = 128;
HSAuint64 block_size = block_size_mb * 1024 * 1024;
PM4Queue queue;
ASSERT_SUCCESS(queue.Create(defaultGPUNode));
/* Test 4 times to see if there is any memory leak.*/
for (int repeat = 1; repeat < 5; repeat++) {
ASSERT_SUCCESS(queue.Create(defaultGPUNode));
for (i = 0; i < ARRAY_ENTRIES; i++) {
ret = hsaKmtAllocMemory(0 /* system */, block_size, m_MemoryFlags,
reinterpret_cast<void**>(&pDb_array[i]));
@@ -904,20 +905,23 @@ TEST_F(KFDMemoryTest, BigBufferStressTest) {
allocationCount = i;
EXPECT_GE(i, allocationCount) << "There might be memory leak!" << std::endl;
while (i--) {
for (int j = 0; j < i; j++) {
/* To see if GPU can access the memory correctly*/
unsigned int *begin = pDb_array[i];
unsigned int *begin = pDb_array[j];
*begin = 0;
queue.PlaceAndSubmitPacket(
PM4WriteDataPacket(begin, 0xdeadbeaf));
queue.Wait4PacketConsumption();
queue.Wait4PacketConsumption(NULL, 300000);
EXPECT_TRUE(WaitOnValue(begin, 0xdeadbeaf));
}
EXPECT_SUCCESS(hsaKmtUnmapMemoryToGPU(pDb_array[i]));
EXPECT_SUCCESS(hsaKmtFreeMemory(pDb_array[i], block_size));
EXPECT_SUCCESS(queue.Destroy());
for (int j = 0; j < i; j++) {
EXPECT_SUCCESS(hsaKmtUnmapMemoryToGPU(pDb_array[j]));
EXPECT_SUCCESS(hsaKmtFreeMemory(pDb_array[j], block_size));
}
}
EXPECT_SUCCESS(queue.Destroy());
/* Reset to run on all task nodes */
NumaNodeBind("all");