All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Grodzovsky <andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Andrey Grodzovsky
	<andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>,
	Christian.Koenig-5C7GfCeVMHo@public.gmane.org
Subject: [PATCH libdrm 4/4] amdgpu: Add memory over allocation test.
Date: Thu, 9 Nov 2017 23:30:03 -0500	[thread overview]
Message-ID: <1510288203-21716-5-git-send-email-andrey.grodzovsky@amd.com> (raw)
In-Reply-To: <1510288203-21716-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>

Allocates 1 TB of memory. Test is disabled by default
since it's triggers OOM killer.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
---
 tests/amdgpu/amdgpu_test.c |  4 ++++
 tests/amdgpu/bo_tests.c    | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c
index 91010dc..3b10f82 100644
--- a/tests/amdgpu/amdgpu_test.c
+++ b/tests/amdgpu/amdgpu_test.c
@@ -417,6 +417,10 @@ static void amdgpu_disable_suits()
 	*/
 	if (amdgpu_set_test_active(DEADLOCK_TESTS_STR, "compute ring block test", CU_FALSE))
 		fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
+
+	/* This test triggers OOM killer terminating the tester itself */
+	if (amdgpu_set_test_active(BO_TESTS_STR, "Memory fail alloc Test", CU_FALSE))
+			fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
 }
 
 /* The main() function for setting up and running the tests.
diff --git a/tests/amdgpu/bo_tests.c b/tests/amdgpu/bo_tests.c
index 4545196..c6d89aa 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_memory_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_memory_fail_alloc },
 	CU_TEST_INFO_NULL,
 };
 
@@ -244,3 +246,21 @@ static void amdgpu_memory_alloc(void)
 	r = gpu_mem_free(bo, va_handle, bo_mc, 4096);
 	CU_ASSERT_EQUAL(r, 0);
 }
+
+static void amdgpu_memory_fail_alloc(void)
+{
+	amdgpu_bo_handle bo;
+	amdgpu_va_handle va_handle;
+	uint64_t bo_mc;
+	int r;
+
+	/* Test impossible mem allocation, 1TB */
+	bo = gpu_mem_alloc(device_handle, 0xE8D4A51000, 4096,
+			AMDGPU_GEM_DOMAIN_VRAM,
+			AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
+	&bo_mc, &va_handle);
+
+	r = gpu_mem_free(bo, va_handle, bo_mc, 0xE8D4A51000);
+	CU_ASSERT_EQUAL(r, 0);
+}
+
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-11-10  4:30 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10  4:29 [PATCH libdrm 0/4] Dynamicly disable suites and tets Andrey Grodzovsky
2017-11-10  4:30 ` [PATCH libdrm 2/4] amdgpu: Use new suite/test disabling functionality Andrey Grodzovsky
2017-12-15 18:08   ` Emil Velikov
     [not found]     ` <CACvgo52uH62kzhS1ZDFOyrLiX8vZz5vcSV5P5ujWNwqdQdCi_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-12-15 18:27       ` [PATCH libdrm] tests/amdgpu: Restore return CUE_SUCCESS to suite_vcn_tests_clean Andrey Grodzovsky
2017-12-15 18:28         ` Christian König
     [not found]         ` <1513362432-1866-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2017-12-15 18:38           ` Emil Velikov
     [not found] ` <1510288203-21716-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2017-11-10  4:30   ` [PATCH libdrm 1/4] amdgpu: Add functions to disable suites and tests Andrey Grodzovsky
2017-11-10  4:30   ` [PATCH libdrm 3/4] amdgpu: Move memory alloc tests in bo suite Andrey Grodzovsky
2017-11-10  4:30   ` Andrey Grodzovsky [this message]
2017-11-10 12:17 ` [PATCH libdrm 0/4] Dynamicly disable suites and tets Christian König
2017-11-10 12:34   ` Christian König
2017-11-10 15:36   ` Andrey Grodzovsky
     [not found]     ` <407f0a79-e15b-61b7-2e3a-8f4b680c9c6c-5C7GfCeVMHo@public.gmane.org>
2017-11-10 15:48       ` Christian König
2017-11-10 23:43         ` Andrey Grodzovsky
2017-11-12  9:35           ` Christian König
2017-11-13 11:32             ` Michel Dänzer
     [not found]               ` <7a5b2721-5938-c865-27b0-47dae1ad5883-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-11-13 12:39                 ` Christian König
     [not found]                   ` <cbb173a7-289f-c13d-5518-55ea20a69b58-5C7GfCeVMHo@public.gmane.org>
2017-11-13 14:57                     ` Andrey Grodzovsky
     [not found]                       ` <faf30a58-a8cf-05b2-6028-065438b38f07-5C7GfCeVMHo@public.gmane.org>
2017-11-13 15:27                         ` Christian König
     [not found]                           ` <bcf0bcfa-d275-1c57-e7a0-2858ebd5b082-5C7GfCeVMHo@public.gmane.org>
2017-11-13 15:36                             ` Andrey Grodzovsky
2017-11-13 17:01                             ` [PATCH libdrm v2] amdgpu: Add memory over allocation test Andrey Grodzovsky
     [not found]                               ` <1510592502-2230-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2017-11-14  8:44                                 ` Christian König
2017-11-14 12:53                                   ` Andrey Grodzovsky
     [not found]                                     ` <a82f7934-77a8-7ebb-1fb8-51961ebba279-5C7GfCeVMHo@public.gmane.org>
2017-11-14 13:25                                       ` Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1510288203-21716-5-git-send-email-andrey.grodzovsky@amd.com \
    --to=andrey.grodzovsky-5c7gfcevmho@public.gmane.org \
    --cc=Christian.Koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.