Add support for CRIU testing

Change-Id: I8945a078ee8ae491245da6091e64b118584a48ab
Este commit está contenido en:
Ramesh Errabolu
2022-09-12 16:27:14 -05:00
cometido por Felix Kuehling
padre 45fad29752
commit 75428364a7
Se han modificado 4 ficheros con 52 adiciones y 0 borrados
+30
Ver fichero
@@ -39,6 +39,9 @@
#include "SDMAPacket.hpp"
#include "linux/kfd_ioctl.h"
/* Captures user specified time (seconds) to sleep */
extern unsigned int g_SleepTime;
void KFDMemoryTest::SetUp() {
ROUTINE_START
@@ -93,6 +96,15 @@ TEST_F(KFDMemoryTest, MMapLarge) {
int i = 0;
/* Allocate 1024GB, aka 1TB*/
for (; i < nObjects; i++) {
/* Code snippet to allow CRIU checkpointing */
if (i == (1 << 6)) {
if (g_SleepTime > 0) {
LOG() << "Pause for: " << g_SleepTime << " seconds" << std::endl;
sleep(g_SleepTime);
}
}
if (hsaKmtRegisterMemory(addr + i, s - i))
break;
if (hsaKmtMapMemoryToGPUNodes(addr + i, s - i,
@@ -633,6 +645,7 @@ void KFDMemoryTest::BinarySearchLargestBuffer(int allocNode, const HsaMemFlags &
HSAuint64 highMB, int nodeToMap,
HSAuint64 *lastSizeMB) {
int ret;
int iter = 0;
HsaMemMapFlags mapFlags = {0};
HSAuint64 granularityMB = highMB > 512 ? 128 : 16;
@@ -656,6 +669,15 @@ void KFDMemoryTest::BinarySearchLargestBuffer(int allocNode, const HsaMemFlags &
continue;
}
/* Code snippet to allow CRIU checkpointing */
iter++;
if (iter == 3) {
if (g_SleepTime > 0) {
LOG() << "Pause for: " << g_SleepTime << " seconds" << std::endl;
sleep(g_SleepTime);
}
}
ret = hsaKmtMapMemoryToGPUNodes(pDb, size, NULL,
mapFlags, 1, reinterpret_cast<HSAuint32 *>(&nodeToMap));
if (ret) {
@@ -908,6 +930,14 @@ TEST_F(KFDMemoryTest, MMBench) {
HSAuint64 allocTime, map1Time, unmap1Time, mapAllTime, unmapAllTime, freeTime;
HSAuint32 allocNode;
/* Code snippet to allow CRIU checkpointing */
if (testIndex == 3) {
if (g_SleepTime > 0) {
LOG() << "Pause for: " << g_SleepTime << " seconds" << std::endl;
sleep(g_SleepTime);
}
}
if ((testIndex % nSizes) == 0)
LOG() << "--------------------------------------------------------------------------" << std::endl;