drm: Branch 'master'

[email protected] (Christian K??nig) Tue, 14 Nov 2017 13:27:04 +0000 (UTC)
Newsgroups gmane.comp.video.dri.patches
Message-ID <[email protected]>
 tests/amdgpu/bo_tests.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

New commits:
commit 9ad9b7e91ee8af621bb80bb80ecd0f76eba7c51c
Author: Andrey Grodzovsky <[email protected]>
Date:   Mon Nov 13 12:01:42 2017 -0500

    amdgpu: Add memory over allocation test.
    
    Allocates 1 TB of memory. Test is disabled by default
    since it's triggers OOM killer.
    
    v2:
    FIx the test to only alloc the BO and assert if return value
    not equal to -ENOMEM and remove test disable on start.
    
    Signed-off-by: Andrey Grodzovsky <[email protected]>
    Reviewed-by: Christian König <[email protected]>

diff --git a/tests/amdgpu/bo_tests.c b/tests/amdgpu/bo_tests.c
index 45451960..53e76c1b 100644
--- a/tests/amdgpu/bo_tests.c
+++ b/tests/amdgpu/bo_tests.c
@@ -47,6 +47,7 @@ static void amdgpu_bo_export_import(void);
 static void amdgpu_bo_metadata(void);
 static void amdgpu_bo_map_unmap(void);
 static void amdgpu_memory_alloc(void);
+static void amdgpu_mem_fail_alloc(void);
 
 CU_TestInfo bo_tests[] = {
 	{ "Export/Import",  amdgpu_bo_export_import },
@@ -55,6 +56,7 @@ CU_TestInfo bo_tests[] = {
 #endif
 	{ "CPU map/unmap",  amdgpu_bo_map_unmap },
 	{ "Memory alloc Test",  amdgpu_memory_alloc },
+	{ "Memory fail alloc Test",  amdgpu_mem_fail_alloc },
 	CU_TEST_INFO_NULL,
 };
 
@@ -244,3 +246,25 @@ static void amdgpu_memory_alloc(void)
 	r = gpu_mem_free(bo, va_handle, bo_mc, 4096);
 	CU_ASSERT_EQUAL(r, 0);
 }
+
+static void amdgpu_mem_fail_alloc(void)
+{
+	amdgpu_bo_handle bo;
+	int r;
+	struct amdgpu_bo_alloc_request req = {0};
+	amdgpu_bo_handle buf_handle;
+
+	/* Test impossible mem allocation, 1TB */
+	req.alloc_size = 0xE8D4A51000;
+	req.phys_alignment = 4096;
+	req.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
+	req.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
+
+	r = amdgpu_bo_alloc(device_handle, &req, &buf_handle);
+	CU_ASSERT_EQUAL(r, -ENOMEM);
+
+	if (!r) {
+		r = amdgpu_bo_free(bo);
+		CU_ASSERT_EQUAL(r, 0);
+	}
+}

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

--
_______________________________________________
Dri-patches mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-patches