From fe8d8c15f11a7a7d59abf60edc0d0f6bce412bf9 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 4 Sep 2024 14:35:01 +0000 Subject: [PATCH] kfdtest: Fix ISA buffers not executable Fix for some places where the ISA buffers are not declared as executable. Previous code in Thunk was blindly setting exec bit on all memory allocations so this issue was masked. Change-Id: Ic7a1169c69fb85ff9e8ea7bcc49a1845b37c08ff --- libhsakmt/tests/kfdtest/src/KFDLocalMemoryTest.cpp | 6 +++--- libhsakmt/tests/kfdtest/src/KFDSVMRangeTest.cpp | 8 ++++---- libhsakmt/tests/kfdtest/src/RDMATest.cpp | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libhsakmt/tests/kfdtest/src/KFDLocalMemoryTest.cpp b/libhsakmt/tests/kfdtest/src/KFDLocalMemoryTest.cpp index 7f00b31d1..7958c84e5 100644 --- a/libhsakmt/tests/kfdtest/src/KFDLocalMemoryTest.cpp +++ b/libhsakmt/tests/kfdtest/src/KFDLocalMemoryTest.cpp @@ -93,7 +93,7 @@ TEST_F(KFDLocalMemoryTest, BasicTest) { return; } - HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode); + HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/); HsaMemoryBuffer srcSysBuffer(BufferSize, defaultGPUNode, false); HsaMemoryBuffer destSysBuffer(BufferSize, defaultGPUNode); HsaMemoryBuffer srcLocalBuffer(BufferSize, defaultGPUNode, false, true); @@ -151,7 +151,7 @@ TEST_F(KFDLocalMemoryTest, VerifyContentsAfterUnmapAndMap) { return; } - HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode); + HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/); HsaMemoryBuffer SysBufferA(BufferSize, defaultGPUNode, false); HsaMemoryBuffer SysBufferB(BufferSize, defaultGPUNode, true); HsaMemoryBuffer LocalBuffer(BufferSize, defaultGPUNode, false, true); @@ -296,7 +296,7 @@ TEST_F(KFDLocalMemoryTest, Fragmentation) { HsaMemoryBuffer sysBuffer(PAGE_SIZE, defaultGPUNode, false); PM4Queue queue; ASSERT_SUCCESS(queue.Create(defaultGPUNode)); - HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode); + HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/); ASSERT_SUCCESS(m_pAsm->RunAssembleBuf(CopyDwordIsa, isaBuffer.As())); diff --git a/libhsakmt/tests/kfdtest/src/KFDSVMRangeTest.cpp b/libhsakmt/tests/kfdtest/src/KFDSVMRangeTest.cpp index 98b888572..b6821361f 100644 --- a/libhsakmt/tests/kfdtest/src/KFDSVMRangeTest.cpp +++ b/libhsakmt/tests/kfdtest/src/KFDSVMRangeTest.cpp @@ -69,7 +69,7 @@ TEST_P(KFDSVMRangeTest, BasicSystemMemTest) { return; } - HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode); + HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/); HsaSVMRange srcSysBuffer(BufferSize, defaultGPUNode); HsaSVMRange destSysBuffer(BufferSize, defaultGPUNode); @@ -440,7 +440,7 @@ TEST_P(KFDSVMRangeTest, PartialUnmapSysMemTest) { void *pBuf; PM4Queue queue; - HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode); + HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/); HsaSVMRange *sysBuffer; HsaSVMRange destSysBuffer(BufSize, defaultGPUNode); @@ -497,7 +497,7 @@ TEST_P(KFDSVMRangeTest, BasicVramTest) { return; } - HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode); + HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/); HsaSVMRange srcSysBuffer(BufferSize, defaultGPUNode); HsaSVMRange locBuffer(BufferSize, defaultGPUNode, defaultGPUNode); HsaSVMRange destSysBuffer(BufferSize, defaultGPUNode); @@ -945,7 +945,7 @@ TEST_P(KFDSVMRangeTest, MigratePolicyTest) { */ //#define USE_PM4_QUEUE_TRIGGER_VM_FAULT #ifdef USE_PM4_QUEUE_TRIGGER_VM_FAULT - HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode); + HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/); PM4Queue queue; ASSERT_SUCCESS(m_pAsm->RunAssembleBuf(CopyDwordIsa, isaBuffer.As())); diff --git a/libhsakmt/tests/kfdtest/src/RDMATest.cpp b/libhsakmt/tests/kfdtest/src/RDMATest.cpp index fd7cefa19..1a66ef76f 100644 --- a/libhsakmt/tests/kfdtest/src/RDMATest.cpp +++ b/libhsakmt/tests/kfdtest/src/RDMATest.cpp @@ -57,7 +57,7 @@ TEST_F(RDMATest, GPUDirect) { int defaultGPUNode = m_NodeInfo.HsaDefaultGPUNode(); ASSERT_GE(defaultGPUNode, 0) << "failed to get default GPU Node"; - HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode); + HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/); HsaMemoryBuffer srcSysBuffer(BufferSize, defaultGPUNode, false); HsaMemoryBuffer srcLocalBuffer(BufferSize, defaultGPUNode, false, true); @@ -130,7 +130,7 @@ TEST_F(RDMATest, ContiguousVRAMAllocation) { return; } - HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode); + HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/); HsaMemoryBuffer srcSysBuffer(PAGE_SIZE, defaultGPUNode, false); void *LocalBuffer; HsaMemFlags memFlags = {0};