RE: [PATCH i-g-t] tests/xe_waitfence: Add user-fence-no-signal subtest

"Goyal, Nakshtra" <[email protected]>
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <SN7PR11MB7489097BD5AE810E3DA349AF85DA2@SN7PR11MB7489.namprd11.prod.outlook.com>

> -----Original Message-----
> From: igt-dev <[email protected]> On Behalf Of
> [email protected]
> Sent: 14 August 2026 07:43
> To: [email protected]; Dandamudi, Priyanka
> <[email protected]>
> Subject: [PATCH i-g-t] tests/xe_waitfence: Add user-fence-no-signal subtest
> 
> From: Priyanka Dandamudi <[email protected]>
> 
> Add a negative test that creates a buffer object, maps it, and calls
> __xe_wait_ufence() waiting for a value that is never written to the buffer. The
> test verifies that the ioctl returns -ETIME on timeout rather than hanging
> indefinitely, reproducing the hang scenario observed when a user fence is
> never signaled.
> 
> Signed-off-by: Priyanka Dandamudi <[email protected]>

LGTM,
Reviewed-by: Nakshtra Goyal <[email protected]>

> ---
>  tests/intel/xe_waitfence.c | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/tests/intel/xe_waitfence.c b/tests/intel/xe_waitfence.c index
> ff92a13fa3..ecdce9f93b 100644
> --- a/tests/intel/xe_waitfence.c
> +++ b/tests/intel/xe_waitfence.c
> @@ -138,6 +138,37 @@ waitfence(int fd, enum waittype wt)
>  	}
>  }
> 
> +/**
> + * SUBTEST: user-fence-no-signal
> + * Functionality: waitfence
> + * Description: Create a BO, map it, and call __xe_wait_ufence waiting for a
> + *              value that is never written. Expects -ETIME on timeout.
> + * Test category: negative test
> + */
> +static void
> +user_fence_no_signal(int fd)
> +{
> +	uint32_t vm, exec_queue, bo;
> +	uint64_t *ptr;
> +	int64_t timeout = NSEC_PER_SEC;
> +	int ret;
> +
> +	vm = xe_vm_create(fd, 0, 0);
> +	exec_queue = xe_exec_queue_create_class(fd, vm,
> +DRM_XE_ENGINE_CLASS_COPY);
> +
> +	bo = xe_bo_create(fd, vm, SZ_4K, system_memory(fd), 0);
> +	ptr = xe_bo_map(fd, bo, SZ_4K);
> +	igt_assert(ptr != MAP_FAILED);
> +
> +	ret = __xe_wait_ufence(fd, ptr, 0xdeadbeef, exec_queue, &timeout);
> +	igt_assert_eq(ret, -ETIME);
> +
> +	munmap(ptr, SZ_4K);
> +	gem_close(fd, bo);
> +	xe_exec_queue_destroy(fd, exec_queue);
> +	xe_vm_destroy(fd, vm);
> +}
> +
>  /**
>   * SUBTEST: invalid-flag
>   * Functionality: waitfence
> @@ -291,6 +322,9 @@ int igt_main()
>  	igt_subtest("engine")
>  		waitfence(fd, ENGINE);
> 
> +	igt_subtest("user-fence-no-signal")
> +		user_fence_no_signal(fd);
> +
>  	igt_subtest("invalid-flag")
>  		invalid_flag(fd);
> 
> --
> 2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.