Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Zhang <jesse.zhang@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Christian Koenig <christian.koenig@amd.com>,
	Jesse Zhang <jesse.zhang@amd.com>,
	Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	Jesse Zhang <Jesse.Zhang@amd.com>
Subject: [PATCH i-g-t V3] tests/amd_basic:fix eviction test failure
Date: Tue, 26 Mar 2024 10:34:40 +0800	[thread overview]
Message-ID: <20240326023440.2460660-1-jesse.zhang@amd.com> (raw)

Test case name:igt@amdgpu/amd_basic@eviction-test-with-ip-dma@eviction_test
Fail error: "Starting subtest: eviction-test-with-IP-DMA
Starting dynamic subtest: eviction_test
(amd_basic:9425) amdgpu/amd_command_submission-CRITICAL: Test assertion failure function amdgpu_test_exec_cs_helper, file ../lib/amdgpu/amd_command_submission.c:77:
(amd_basic:9425) amdgpu/amd_command_submission-CRITICAL: Failed assertion: r == 0
(amd_basic:9425) amdgpu/amd_command_submission-CRITICAL: Last errno: 12, Cannot allocate memory
(amd_basic:9425) amdgpu/amd_command_submission-CRITICAL: error: -12 != 0
Dynamic subtest eviction_test failed.

There is a case where the system size and gtt memory are smaller.
When evicting vram to gtt or system memory, there is not enough gtt or memory system memory available for allocation.
Therefore, try to reduce the use of gtt during initialization to meet the requirements for evicting vram.

V3: Provided an example in the code of exactly the numeric number (Vitaly)
    Remove the space and empty line (Kamil)

Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
---
 tests/amdgpu/amd_basic.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/tests/amdgpu/amd_basic.c b/tests/amdgpu/amd_basic.c
index 70e45649d..8819b9cd4 100644
--- a/tests/amdgpu/amd_basic.c
+++ b/tests/amdgpu/amd_basic.c
@@ -358,6 +358,20 @@ amdgpu_bo_eviction_test(amdgpu_device_handle device_handle)
 				   0, &vram_info);
 	igt_assert_eq(r, 0);
 
+	r = amdgpu_query_heap_info(device_handle, AMDGPU_GEM_DOMAIN_GTT,
+				   0, &gtt_info);
+	igt_assert_eq(r, 0);
+
+	/* For smaller gtt memory sizes, reduce gtt usage on initialization
+	 * to satisfy eviction vram requirements. Example:
+	 * gtt_info.heap_size 3036569600, gtt_info.max_allocation 2114244608  gtt_info.heap_usage 12845056
+	 * gtt_info.heap_size 2895 mb, gtt_info.max_allocation 2016 mb gtt_info.heap_usage 12 mb
+	 * vram_info.heap_size 2114244608, vram_info.max_allocation 2114244608 vram_info.heap_usage 26951680
+	 * vram_info.heap_size 2016 mb, vram_info.max_allocation 2016 mb vram_info.heap_usage 25 mb
+	 */
+	if (gtt_info.heap_size - gtt_info.max_allocation < vram_info.max_allocation)
+		gtt_info.max_allocation /=3;
+
 	r = amdgpu_bo_alloc_wrap(device_handle, vram_info.max_allocation, 4096,
 				 AMDGPU_GEM_DOMAIN_VRAM, 0, &ring_context->boa_vram[0]);
 	igt_assert_eq(r, 0);
@@ -365,10 +379,6 @@ amdgpu_bo_eviction_test(amdgpu_device_handle device_handle)
 				 AMDGPU_GEM_DOMAIN_VRAM, 0, &ring_context->boa_vram[1]);
 	igt_assert_eq(r, 0);
 
-	r = amdgpu_query_heap_info(device_handle, AMDGPU_GEM_DOMAIN_GTT,
-				   0, &gtt_info);
-	igt_assert_eq(r, 0);
-
 	r = amdgpu_bo_alloc_wrap(device_handle, gtt_info.max_allocation, 4096,
 				 AMDGPU_GEM_DOMAIN_GTT, 0, &ring_context->boa_gtt[0]);
 	igt_assert_eq(r, 0);
-- 
2.25.1


             reply	other threads:[~2024-03-26  2:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26  2:34 Jesse Zhang [this message]
2024-03-26  2:38 ` [PATCH i-g-t V3] tests/amd_basic:fix eviction test failure vitaly prosyak
2024-03-26  3:30 ` ✓ CI.xeBAT: success for " Patchwork
2024-03-26  3:39 ` ✓ Fi.CI.BAT: " Patchwork
2024-03-26 11:19 ` [PATCH i-g-t V3] " Kamil Konieczny
2024-03-27  3:29   ` vitaly prosyak
2024-03-27  1:26 ` ✗ Fi.CI.IGT: failure for " Patchwork

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=20240326023440.2460660-1-jesse.zhang@amd.com \
    --to=jesse.zhang@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=vitaly.prosyak@amd.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox