[PATCH i-g-t] lib/xe: Make running under Valgrind quiet

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Feb 21 13:17:03 UTC 2025


Hi Tvrtko,
On 2025-02-04 at 17:39:33 +0000, Tvrtko Ursulin wrote:
> Let Valgrind know which memory is initialised by ioctls so running tests
> under it becomes less noisy.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
> ---
>  lib/igt_syncobj.c |  4 +---
>  lib/xe/xe_query.c | 21 +++++++++++++++++++++

Please split this into two separate patches, you can add
then my r-b to both.

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

>  2 files changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_syncobj.c b/lib/igt_syncobj.c
> index a53393bd7245..4a62890b4bbf 100644
> --- a/lib/igt_syncobj.c
> +++ b/lib/igt_syncobj.c
> @@ -197,14 +197,12 @@ int
>  syncobj_wait_err(int fd, uint32_t *handles, uint32_t count,
>  		 uint64_t abs_timeout_nsec, uint32_t flags)
>  {
> -	struct drm_syncobj_wait wait;
> +	struct drm_syncobj_wait wait = { };
>  
>  	wait.handles = to_user_pointer(handles);
>  	wait.timeout_nsec = abs_timeout_nsec;
>  	wait.count_handles = count;
>  	wait.flags = flags;
> -	wait.first_signaled = 0;
> -	wait.pad = 0;
>  
>  	return __syncobj_wait(fd, &wait);
>  }
> diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
> index ec2b127b7e87..0d2e4805c8ee 100644
> --- a/lib/xe/xe_query.c
> +++ b/lib/xe/xe_query.c
> @@ -9,6 +9,15 @@
>  #include <stdlib.h>
>  #include <pthread.h>
>  
> +#ifdef HAVE_VALGRIND
> +#include <valgrind/valgrind.h>
> +#include <valgrind/memcheck.h>
> +
> +#define VG(x) x
> +#else
> +#define VG(x) do {} while (0)
> +#endif
> +
>  #include "drmtest.h"
>  #include "ioctl_wrappers.h"
>  #include "igt_map.h"
> @@ -34,6 +43,8 @@ static struct drm_xe_query_config *xe_query_config_new(int fd)
>  	query.data = to_user_pointer(config);
>  	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
>  
> +	VG(VALGRIND_MAKE_MEM_DEFINED(config, query.size));
> +
>  	igt_assert(config->num_params > 0);
>  
>  	return config;
> @@ -62,6 +73,8 @@ static uint32_t *xe_query_hwconfig_new(int fd, uint32_t *hwconfig_size)
>  	/* Perform the query to get the actual data */
>  	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
>  
> +	VG(VALGRIND_MAKE_MEM_DEFINED(hwconfig, query.size));
> +
>  	*hwconfig_size = query.size;
>  	return hwconfig;
>  }
> @@ -84,6 +97,8 @@ static struct drm_xe_query_gt_list *xe_query_gt_list_new(int fd)
>  	query.data = to_user_pointer(gt_list);
>  	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
>  
> +	VG(VALGRIND_MAKE_MEM_DEFINED(gt_list, query.size));
> +
>  	return gt_list;
>  }
>  
> @@ -117,6 +132,8 @@ static struct drm_xe_query_engines *xe_query_engines(int fd)
>  	query.data = to_user_pointer(engines);
>  	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
>  
> +	VG(VALGRIND_MAKE_MEM_DEFINED(engines, query.size));
> +
>  	return engines;
>  }
>  
> @@ -138,6 +155,8 @@ static struct drm_xe_query_mem_regions *xe_query_mem_regions_new(int fd)
>  	query.data = to_user_pointer(mem_regions);
>  	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
>  
> +	VG(VALGRIND_MAKE_MEM_DEFINED(mem_regions, query.size));
> +
>  	return mem_regions;
>  }
>  
> @@ -161,6 +180,8 @@ static struct drm_xe_query_oa_units *xe_query_oa_units_new(int fd)
>  	query.data = to_user_pointer(oa_units);
>  	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
>  
> +	VG(VALGRIND_MAKE_MEM_DEFINED(oa_units, query.size));
> +
>  	return oa_units;
>  }
>  
> -- 
> 2.48.0
> 


More information about the Intel-xe mailing list