[PATCH i-g-t 3/3] tests/intel/xe_eudebug_online: Fix 32b compilation errors

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Jan 24 14:07:37 UTC 2025


Hi Dominik,
On 2025-01-22 at 15:44:19 +0100, Dominik Grzegorzek wrote:
> Fix metadata allocation so it is properly sized on 32b and further
> calculations of its size.
> 
> Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek at intel.com>

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

btw imho you could define a macro for count '2' or a macro for
size but I do not know if there are any plans to change it
in future? So instead of:

2 * sizeof(**metadata)

#define EUDEBUG_METADATA_SIZE (2*sizeof(uint64_t))
or even also define '2' as a size for it.

This could be left for later, lets first proceed with this fix.

Regards,
Kamil

> ---
>  tests/intel/xe_eudebug_online.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/intel/xe_eudebug_online.c b/tests/intel/xe_eudebug_online.c
> index 1a146d8c4..726fc55b1 100644
> --- a/tests/intel/xe_eudebug_online.c
> +++ b/tests/intel/xe_eudebug_online.c
> @@ -1063,8 +1063,8 @@ static void run_online_client(struct xe_eudebug_client *c)
>  	uint32_t *ptr;
>  	int fd, vm_flags;
>  
> -	metadata[0] = calloc(2, sizeof(*metadata));
> -	metadata[1] = calloc(2, sizeof(*metadata));
> +	metadata[0] = calloc(2, sizeof(**metadata));
> +	metadata[1] = calloc(2, sizeof(**metadata));
>  	igt_assert(metadata[0]);
>  	igt_assert(metadata[1]);
>  
> @@ -1086,10 +1086,10 @@ static void run_online_client(struct xe_eudebug_client *c)
>  	metadata[1][0] = target_offset;
>  	metadata[1][1] = buf->size;
>  	metadata_id[0] = xe_eudebug_client_metadata_create(c, fd, DRM_XE_DEBUG_METADATA_ELF_BINARY,
> -							   2 * sizeof(*metadata), metadata[0]);
> +							   2 * sizeof(**metadata), metadata[0]);
>  	metadata_id[1] = xe_eudebug_client_metadata_create(c, fd,
>  							   DRM_XE_DEBUG_METADATA_PROGRAM_MODULE,
> -							   2 * sizeof(*metadata), metadata[1]);
> +							   2 * sizeof(**metadata), metadata[1]);
>  
>  	vm_flags = DRM_XE_VM_CREATE_FLAG_LR_MODE;
>  	vm_flags |= c->flags & SHADER_PAGEFAULT ? DRM_XE_VM_CREATE_FLAG_FAULT_MODE : 0;
> @@ -1144,10 +1144,10 @@ static void run_online_client(struct xe_eudebug_client *c)
>  	xe_eudebug_client_vm_destroy(c, fd, create.vm_id);
>  
>  	xe_eudebug_client_metadata_destroy(c, fd, metadata_id[0], DRM_XE_DEBUG_METADATA_ELF_BINARY,
> -					   2 * sizeof(*metadata));
> +					   2 * sizeof(**metadata));
>  	xe_eudebug_client_metadata_destroy(c, fd, metadata_id[1],
>  					   DRM_XE_DEBUG_METADATA_PROGRAM_MODULE,
> -					   2 * sizeof(*metadata));
> +					   2 * sizeof(**metadata));
>  
>  	intel_buf_destroy(buf);
>  
> -- 
> 2.34.1
> 


More information about the igt-dev mailing list