[PATCH i-g-t] tests/intel/xe_vm: Fix skip condition to account for padded BO size

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Jul 17 08:51:28 UTC 2025


Hi Lukasz,
On 2025-06-11 at 12:01:58 +0200, Lukasz Laguna wrote:
> Several subtests currently skip when the requested BO size exceeds
> visible VRAM, but they don't take into account the padded size that is
> actually passed to the kernel when creating BO. As a result, subtest may
> attempt to allocate a BO that exceeds the available VRAM, resulting in
> -E2BIG error.
> 
> Fix this by using the prefetch BO size in the skip condition to ensure
> the subtests avoid allocation attempts that are guaranteed to fail.
> 
> Signed-off-by: Lukasz Laguna <lukasz.laguna at intel.com>

LGTM
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> ---
>  tests/intel/xe_vm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/intel/xe_vm.c b/tests/intel/xe_vm.c
> index 94cca13ba..1a21a6459 100644
> --- a/tests/intel/xe_vm.c
> +++ b/tests/intel/xe_vm.c
> @@ -1385,15 +1385,15 @@ test_large_binds(int fd, struct drm_xe_engine_class_instance *eci,
>  	igt_assert_lte(n_exec_queues, MAX_N_EXEC_QUEUES);
>  	vm = xe_vm_create(fd, 0, 0);
>  
> +	bo_size_prefetch = xe_bb_size(fd, bo_size);
> +
>  	if (flags & LARGE_BIND_FLAG_USERPTR) {
> -		bo_size_prefetch = xe_bb_size(fd, bo_size);
>  		map = aligned_alloc(xe_get_default_alignment(fd), bo_size_prefetch);
>  		igt_assert(map);
>  	} else {
> -		igt_skip_on(xe_visible_vram_size(fd, 0) && bo_size >
> +		igt_skip_on(xe_visible_vram_size(fd, 0) && bo_size_prefetch >
>  			    xe_visible_vram_size(fd, 0));
>  
> -		bo_size_prefetch = xe_bb_size(fd, bo_size);
>  		bo = xe_bo_create(fd, vm, bo_size_prefetch,
>  				  vram_if_possible(fd, eci->gt_id),
>  				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
> -- 
> 2.40.0
> 


More information about the igt-dev mailing list