kfdtest: Full TearDown and SetUp in child process

With the next patch, child processes need to fully reinitialize the
topology in order to recreate the process apertures. Just calling
hsaKmtOpenKFD is no longer sufficient. Tests based on
KFDMultiProcessTest already did this correctly (KFDHWSTest, eviction
tests). This patch fixes KFDExceptionTest and KFDIPCTest.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Change-Id: Iaad24e88ddd29c1105bf791a77891cc55a6072ff


[ROCm/ROCR-Runtime commit: 412b24137e]
This commit is contained in:
Felix Kuehling
2022-07-14 16:45:12 -04:00
parent 93e7565163
commit 7ccda4ba26
3 changed files with 20 additions and 24 deletions
@@ -184,11 +184,8 @@ TEST_F(KFDExceptionTest, AddressFault) {
m_ChildPid = fork();
if (m_ChildPid == 0) {
m_ChildStatus = hsaKmtOpenKFD();
if (m_ChildStatus != HSAKMT_STATUS_SUCCESS) {
WARN() << "KFD open failed in child process" << std::endl;
return;
}
KFDBaseComponentTest::TearDown();
KFDBaseComponentTest::SetUp();
HsaMemoryBuffer srcBuffer(PAGE_SIZE, defaultGPUNode, false);
@@ -228,11 +225,8 @@ TEST_F(KFDExceptionTest, PermissionFault) {
m_ChildPid = fork();
if (m_ChildPid == 0) {
m_ChildStatus = hsaKmtOpenKFD();
if (m_ChildStatus != HSAKMT_STATUS_SUCCESS) {
WARN() << "KFD open failed in child process" << std::endl;
return;
}
KFDBaseComponentTest::TearDown();
KFDBaseComponentTest::SetUp();
HsaMemoryBuffer readOnlyBuffer(PAGE_SIZE, defaultGPUNode, false /*zero*/,
false /*isLocal*/, true /*isExec*/,
@@ -278,11 +272,8 @@ TEST_F(KFDExceptionTest, FaultStorm) {
m_ChildPid = fork();
if (m_ChildPid == 0) {
m_ChildStatus = hsaKmtOpenKFD();
if (m_ChildStatus != HSAKMT_STATUS_SUCCESS) {
WARN() << "KFD open failed in child process" << std::endl;
return;
}
KFDBaseComponentTest::TearDown();
KFDBaseComponentTest::SetUp();
TestMemoryException(defaultGPUNode, 0x12345678, 0x76543210, 1024, 1024, 1);
} else {
@@ -321,11 +312,10 @@ TEST_F(KFDExceptionTest, SdmaQueueException) {
if (m_ChildPid == 0) {
unsigned int* pDb = NULL;
unsigned int *nullPtr = NULL;
m_ChildStatus = hsaKmtOpenKFD();
if (m_ChildStatus != HSAKMT_STATUS_SUCCESS) {
WARN() << "KFD open failed in child process" << std::endl;
return;
}
KFDBaseComponentTest::TearDown();
KFDBaseComponentTest::SetUp();
m_MemoryFlags.ui32.NonPaged = 1;
ASSERT_SUCCESS(hsaKmtAllocMemory(defaultGPUNode, PAGE_SIZE, m_MemoryFlags,
reinterpret_cast<void**>(&pDb)));