From 3f55ba9fb8ca33c62b11bf772e759ab3fe7aec65 Mon Sep 17 00:00:00 2001 From: Eric Huang Date: Wed, 15 Feb 2023 11:44:49 -0500 Subject: [PATCH] kfdtest: add the check for svm usage limit Since KFD counts svm allocation as system memory usage, KFDSVMEvictTest will fail on the case of small system memory, adding check is to skip test. Signed-off-by: Eric Huang Change-Id: I040f16f2dd0d4092d069a632cfba9c28293f781b --- tests/kfdtest/src/KFDSVMEvictTest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/kfdtest/src/KFDSVMEvictTest.cpp b/tests/kfdtest/src/KFDSVMEvictTest.cpp index 22953d01ab..cd61de3c3e 100644 --- a/tests/kfdtest/src/KFDSVMEvictTest.cpp +++ b/tests/kfdtest/src/KFDSVMEvictTest.cpp @@ -69,6 +69,12 @@ HSAint32 KFDSVMEvictTest::GetBufferCounter(HSAuint64 vramSize, HSAuint64 vramBuf */ size = sysMemSize / 3 + vramSize; size = size > vramSize << 1 ? vramSize << 1 : size; + /* Check if there is enough system memory to pass test, + * KFD system memory limit is 15/16. + */ + if (size > (sysMemSize - (sysMemSize >> 4))) + return 0; + sizeInPages = size >> PAGE_SHIFT; count = sizeInPages / (vramBufSizeInPages * N_PROCESSES);