[PATCH i-g-t] tests/amd_basic: fix eviction test failure

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon Mar 25 15:50:51 UTC 2024


Hi Jesse,
On 2024-03-25 at 14:55:34 +0800, Jesse Zhang wrote:

Please start with some introduction, then present error log.

>  Test case name:igt at amdgpu/amd_basic at eviction-test-with-ip-dma@eviction_test
 ^^
Remove spaces/tabs from beginning of log.

>  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.
> 
>  Cc: Vitaly Prosyak <vitaly.prosyak at amd.com>
 ^^
No spaces before Cc: (here and below).

>  Cc: Alex Deucher <alexander.deucher at amd.com>
>  Cc: Christian Koenig <christian.koenig at amd.com>
>  Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> 
Remove empty line.

>  Signed-off-by: Jesse Zhang <Jesse.Zhang at amd.com>
 ^^
No spaces here.

Regards,
Kamil

> ---
>  tests/amdgpu/amd_basic.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/amdgpu/amd_basic.c b/tests/amdgpu/amd_basic.c
> index 70e45649d..8adb8d696 100644
> --- a/tests/amdgpu/amd_basic.c
> +++ b/tests/amdgpu/amd_basic.c
> @@ -340,6 +340,7 @@ amdgpu_bo_eviction_test(amdgpu_device_handle device_handle)
>  	uint64_t gtt_flags[2] = {0, AMDGPU_GEM_CREATE_CPU_GTT_USWC};
>  
>  	const struct amdgpu_ip_block_version *ip_block = get_ip_block(device_handle, AMDGPU_HW_IP_DMA);
> +	uint64_t gtt_allocation;
>  
>  	igt_assert(ip_block);
>  
> @@ -358,6 +359,17 @@ 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 */
> +	if (gtt_info.heap_size - gtt_info.max_allocation < vram_info.max_allocation)
> +		gtt_allocation = gtt_info.max_allocation/3;
> +	else
> +		gtt_allocation = gtt_info.max_allocation;
> +
>  	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 +377,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
> 


More information about the igt-dev mailing list