tests/amdgpu: add amdgpu_vram_frag test
BO allocations can take very long time on a fragmented address space. This test will introduce fragmentation and wait for 100k bo allocation to be done in 5 seconds. Kernel with a recent[1] fix should be able to finish this test in < 5 sec.
Output after this patch with the kernel fix:
./tests/amdgpu/amdgpu_test -s 2
<snip>
Suite: BO Tests
Test: Export/Import ...passed
Test: CPU map/unmap ...passed
Test: Memory alloc Test ...passed
Test: Memory fail alloc Test ...passed
Test: VRAM Fragmentation Test ...
amdgpu_vram_frag: Total time taken 0.475837 secs
passed
Test: Find bo by CPU mapping ...passed
<snip>
Output after this patch without the kernel fix:
./tests/amdgpu/amdgpu_test -s 2
<snip>
Suite: BO Tests
Test: Export/Import ...passed
Test: CPU map/unmap ...passed
Test: Memory alloc Test ...passed
Test: Memory fail alloc Test ...passed
Test: VRAM Fragmentation Test ... timed out
FAILED
1. ../tests/amdgpu/bo_tests.c:366 - CU_ASSERT_EQUAL(r,0)
Test: Find bo by CPU mapping ...passed
<snip>
[1] https://cgit.freedesktop.org/drm/drm/commit/?id=0cdea4455acd350a7f62406478e3d6d1f764cef9 Signed-off-by: Nirmoy Das nirmoy.das@amd.com
Edited by Simon Ser