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: Alex Deucher <alexander.deucher@amd.com>,
	Christian Koenig <christian.koenig@amd.com>
Subject: [PATCH i-g-t V3] tests/amdgpu: fix VM test issue
Date: Mon, 18 Dec 2023 10:53:07 +0800	[thread overview]
Message-ID: <20231218025307.1837517-1-jesse.zhang@amd.com> (raw)

Test case name:igt@amdgpu/amd_vm@amdgpu-vm-unaligned-map
Fail error: "Starting subtest: amdgpu-vm-unaligned-map
(amd_vm:8876) CRITICAL: Test assertion failure function amdgpu_vm_unaligned_map, file ../tests/amdgpu/amd_vm.c:131:
(amd_vm:8876) CRITICAL: Failed assertion: r == 0
(amd_vm:8876) CRITICAL: Last errno: 12, Cannot allocate memory
(amd_vm:8876) CRITICAL: error: -12 != 0
Subtest amdgpu-vm-unaligned-map failed.

V3:
   - Split the test into two, one for the 2M (using 8M allocations)
     case and one for the 1G case (using 4G allocation). (Christian)

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_vm.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tests/amdgpu/amd_vm.c b/tests/amdgpu/amd_vm.c
index 11be25ae8..dab91f291 100644
--- a/tests/amdgpu/amd_vm.c
+++ b/tests/amdgpu/amd_vm.c
@@ -115,11 +115,11 @@ amdgpu_vmid_reserve_test(amdgpu_device_handle device_handle,
 static void
 amdgpu_vm_unaligned_map(amdgpu_device_handle device_handle)
 {
-	const uint64_t map_size = (4ULL << 30) - (2 << 12);
+	uint64_t map_size = (4ULL << 30) - (2 << 12);
 	struct amdgpu_bo_alloc_request request = {};
 	amdgpu_bo_handle buf_handle;
 	amdgpu_va_handle handle;
-	uint64_t vmc_addr;
+	uint64_t vmc_addr, alignment = 1ULL << 30;
 	int r;
 
 	request.alloc_size = 4ULL << 30;
@@ -127,11 +127,18 @@ amdgpu_vm_unaligned_map(amdgpu_device_handle device_handle)
 	request.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
 	request.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
 
-	r = amdgpu_bo_alloc(device_handle, &request, &buf_handle);
+	if (-ENOMEM == amdgpu_bo_alloc(device_handle, &request, &buf_handle)) {
+		/* Try allocate on the device of small memory */
+		request.alloc_size = 8ULL << 20;
+		map_size = (8ULL << 20) - (2 << 12);
+		alignment = 2ULL << 20;
+		r = amdgpu_bo_alloc(device_handle, &request, &buf_handle);
+	}
+
 	igt_assert_eq(r, 0);
 
 	r = amdgpu_va_range_alloc(device_handle, amdgpu_gpu_va_range_general,
-				4ULL << 30, 1ULL << 30, 0, &vmc_addr,
+				request.alloc_size, alignment, 0, &vmc_addr,
 				&handle, 0);
 	igt_assert_eq(r, 0);
 
-- 
2.25.1

WARNING: multiple messages have this Message-ID (diff)
From: Jesse Zhang <jesse.zhang@amd.com>
To: igt-dev@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Christian Koenig <christian.koenig@amd.com>
Subject: [PATCH i-g-t V3] tests/amdgpu: fix VM test issue
Date: Mon, 18 Dec 2023 10:53:07 +0800	[thread overview]
Message-ID: <20231218025307.1837517-1-jesse.zhang@amd.com> (raw)
Message-ID: <20231218025307.M6DxaIytRMGulIFM6lAVuQzqRdRDZAm8-KLry6AcQ4Q@z> (raw)

Test case name:igt@amdgpu/amd_vm@amdgpu-vm-unaligned-map
Fail error: "Starting subtest: amdgpu-vm-unaligned-map
(amd_vm:8876) CRITICAL: Test assertion failure function amdgpu_vm_unaligned_map, file ../tests/amdgpu/amd_vm.c:131:
(amd_vm:8876) CRITICAL: Failed assertion: r == 0
(amd_vm:8876) CRITICAL: Last errno: 12, Cannot allocate memory
(amd_vm:8876) CRITICAL: error: -12 != 0
Subtest amdgpu-vm-unaligned-map failed.

V3:
   - Split the test into two, one for the 2M (using 8M allocations)
     case and one for the 1G case (using 4G allocation). (Christian)

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_vm.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tests/amdgpu/amd_vm.c b/tests/amdgpu/amd_vm.c
index 11be25ae8..dab91f291 100644
--- a/tests/amdgpu/amd_vm.c
+++ b/tests/amdgpu/amd_vm.c
@@ -115,11 +115,11 @@ amdgpu_vmid_reserve_test(amdgpu_device_handle device_handle,
 static void
 amdgpu_vm_unaligned_map(amdgpu_device_handle device_handle)
 {
-	const uint64_t map_size = (4ULL << 30) - (2 << 12);
+	uint64_t map_size = (4ULL << 30) - (2 << 12);
 	struct amdgpu_bo_alloc_request request = {};
 	amdgpu_bo_handle buf_handle;
 	amdgpu_va_handle handle;
-	uint64_t vmc_addr;
+	uint64_t vmc_addr, alignment = 1ULL << 30;
 	int r;
 
 	request.alloc_size = 4ULL << 30;
@@ -127,11 +127,18 @@ amdgpu_vm_unaligned_map(amdgpu_device_handle device_handle)
 	request.preferred_heap = AMDGPU_GEM_DOMAIN_VRAM;
 	request.flags = AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
 
-	r = amdgpu_bo_alloc(device_handle, &request, &buf_handle);
+	if (-ENOMEM == amdgpu_bo_alloc(device_handle, &request, &buf_handle)) {
+		/* Try allocate on the device of small memory */
+		request.alloc_size = 8ULL << 20;
+		map_size = (8ULL << 20) - (2 << 12);
+		alignment = 2ULL << 20;
+		r = amdgpu_bo_alloc(device_handle, &request, &buf_handle);
+	}
+
 	igt_assert_eq(r, 0);
 
 	r = amdgpu_va_range_alloc(device_handle, amdgpu_gpu_va_range_general,
-				4ULL << 30, 1ULL << 30, 0, &vmc_addr,
+				request.alloc_size, alignment, 0, &vmc_addr,
 				&handle, 0);
 	igt_assert_eq(r, 0);
 
-- 
2.25.1

             reply	other threads:[~2023-12-18 18:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18  2:53 Jesse Zhang [this message]
2023-12-18  2:53 ` [PATCH i-g-t V3] tests/amdgpu: fix VM test issue Jesse Zhang
2023-12-18 11:32 ` Christian König
2023-12-18 19:00 ` ✓ Fi.CI.BAT: success for tests/amdgpu: fix VM test issue (rev3) Patchwork
2023-12-18 19:25 ` ✓ CI.xeBAT: " Patchwork
2023-12-18 20:15 ` ✗ Fi.CI.IGT: failure " 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=20231218025307.1837517-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 \
    /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